A writ is an order issued by the court to either a lower court or to government officials. There are many types and many purposes for writs, but usually they are employed in situations where a court needs something done but has found usual remedies lacking. The writ of habeas corpus, for example, is the most famous sort of writ in the United States. A writ of habeas corpus is a legal document ordering any law enforcement agency or official who has taken a prisoner to bring them to court. Without habeas corpus, a prisoner may not have access to a speedy trial, and, as in colonial times, could be held without seeing a judge for a very long time.
A writ of mandamus is another form of writ sometimes employed by courts in the United States: It is an order by the court to a government official not under their jurisdiction to take some action. In the famous Marbury v. Madison, the court issued a writ (order) to the Secretary of State. Marbury, a judge who had not received his commission, wanted the court to issue a writ ordering the Secretary to deliver commissions (job offers), which Marbury felt he was legally bound to do but had not done. The court reviewed the law but did not issue the writ, establishing the practice of judicial review.