A writ of assistance is a written order (a writ) issued by a court instructing a law enforcement official, such as a sheriff, to perform a certain task. Historically, several types of writs have been called "writs of assistance". Most often, a writ of assistance is "used to enforce an order for the possession of lands". When used to evict someone from real property, such a writ is also called a writ of restitution or a writ of possession. In the area of customs, writs of assistance were first authorized by an act of the English Parliament in 1660 (12 Charles 2 c. 29), and were issued by the Court of Exchequer to help customs officials search for smuggled goods. These writs were called "writs of assistance" because they called upon sheriffs, other officials, and loyal subjects to "assist" the customs official in carrying out his duties.
In practice, customs writs of assistance served as general search warrants that did not expire, allowing customs officials to search anywhere for smuggled goods without having to obtain a specific warrant. These writs became controversial when they were issued by courts in British America in the 1760s, especially the Province of Massachusetts Bay. Controversy over these general writs of assistance inspired the Fourth Amendment to the United States Constitution, which forbids general search warrants in the United States. In the United Kingdom, general writs of assistance continued to be issued until 1819.
General writs of assistance played an important role in the increasing difficulties that led to the American Revolution and the creation of the United States of America. In 1760, Great Britain began to enforce some of the provisions of the Navigation Acts by granting customs officers these writs. In New England, smuggling had become common. However, officers could not search a person's property without giving a reason. Colonists protested that the writs violated their rights as British subjects. The colonists had several problems with these writs. They were permanent and even transferable: a writ holder could assign them to another. Any place could be searched at the whim of the holder, and searchers were not responsible for any damage they caused. This put anyone who had such a writ above the law.
All writs of assistance expired six months after death of the king, at which time new writs had to be obtained. With the death of King George II in October 1760, all writs were set to expire on 25 April 1761. The crisis began on 27 December 1760 when news of King George II's death reached Boston and the people of Massachusetts learned that all writs faced termination.
Within three weeks, the writs were challenged by a group of 63 Boston merchants represented by fiery Boston attorney James Otis, Jr. A countersuit was filed by a British customs agent Paxton, and together these are known as "Paxton’s case."  Otis argued the famous writs of assistance case in February 1761 and again on 16 November 1761. Although Otis technically lost, his challenge to the authority of Parliament made a strong impression on John Adams, who was present, and thereby eventually contributed to the American Revolution. In a pamphlet published three years later, in 1765, Otis expanded his argument that the general writs violated the British unwritten constitution harkening back to Magna Carta. Any law in violation of the constitution or "natural law" which underlay it, was void. 
A writ of assistance was used in an incident known as the "Malcom Affair," which was described by legal scholar William Cuddihy as "the most famous search in colonial America." The episode demonstrated a fundamental difference between the colonists' view of their rights and the official British view of imperial law. "The Malcom affair was a minor matter, a comedy of blundering revenue officers and barricaded colonials," wrote legal historian John Phillip Reid, "but were we to dismiss it in haste we might run the risk of dismissing much of the story of the American Revolution."
On 24 September 1766, customs officials in Boston, with a deputy sheriff, searched merchant Daniel Malcom's home, which was also his place of business. They claimed the authority to do so by a writ of assistance issued to customs official Benjamin Hallowell, and the information of a confidential informant. Malcom allowed them to search, but denied them access to a locked cellar, arguing that they did not have the legal authority to break it open. According to customs officials, Malcom threatened to use force to prevent them from opening the door; according to Malcom and his supporters, his threat specified resisting any unlawful forced entry.
The officials left and returned with a specific search warrant, only to find that Malcom had locked his house. A crowd supportive of Malcom had gathered around the house; Tories claimed that this "mob" numbered 300 or more people and was hostile to the customs officers, while Whigs insisted that this was a peaceful gathering of about 50 curious onlookers, mostly boys. No violence occurred, but reports written by Governor Francis Bernard and the customs officials created the impression in Britain that a riot had taken place. The incident furthered Boston's reputation in Britain as a lawless town controlled by "mobs", a reputation that would contribute to the government's decision to send troops in 1768.
Although British officials, and some historians, described Malcom as acting in defiance of the law, John Phillip Reid argued that Malcom's actions were lawful—so precisely lawful, in fact, that Reid speculated that Malcom may have been acting under the advice of his lawyer, James Otis. According to Reid, Malcom and Otis may have been attempting to provoke a lawsuit so that they could once again "challenge the validity of writs of assistance" in court. This was one of several incidents when a Boston merchant resisted a search with a seemingly exact knowledge of the law; John Hancock would act in a similar manner when customs officials attempted to search his ship Lydia in 1768.
Uncertainty about the legality of writs of assistance issued by colonial superior courts prompted Parliament to affirm that such writs were legal in the 1767 Townshend Acts. However, most colonial courts refused to issue general writs, and the Malcom case was apparently the last time a writ of assistance was issued in Boston.