A writ of mandamus or simply mandamus, which means "we order" in Latin, is the name of one of the prerogative writs and is a court order directing someone to perform a specified act. The act must be one that is "ministerial" rather than "discretionary," which means it must not involve any qualitative judgment to tell whether it has been done (or done right or completely): Signing a document or handing one over to someone is ministerial; providing some service is discretionary, whether it is painting a portrait or removing a gall bladder or cutting hair or typing a letter. (In that sense, "ministerial" has a "binary" meaning—the act is either done or not done.)
In the administrative law context in the United States, the requirement that mandamus can be used only to compel a ministerial act has largely been abandoned. By statute or by judicial expansion of the writ of mandamus in most of the U.S. states, acts of administrative agencies are now subject to judicial review for abuse of discretion. Judicial review of agencies of the United States federal government for abuse of discretion is authorized by the Administrative Procedure Act.
In the context of mandamus from a United States Court of Appeals to a United States District Court, the Supreme Court of the United States has ruled that the appellate court has discretion to issue mandamus to control an abuse of discretion by the lower court in unusual circumstances, where there is a compelling reason not to wait for an appeal from a final judgment. This discretion is exercised very sparingly. Mandamus was abolished in the District Courts themselves by Rule 81 of the Federal Rules of Civil Procedure, and replaced by the ability to obtain preliminary and permanent injunctions against public officials.
In some state-court systems, however, mandamus has evolved into a general procedure for discretionary appeals from nonfinal trial-court decisions.
In some U.S. states, including California, the writ is now called mandate instead of mandamus, and may be issued by any level of the state court system to any lower court or to any government official. It is still common for Californians to bring "taxpayer actions" against public officials for wasting public funds through mismanagement of a government agency, where the relief sought is a writ of mandate compelling the official to stop wasting money and fulfill his duty to protect the public fisc.
In other states, including New York, have replaced mandamus (as well as the other prerogative writs) with statutory procedures. In New York this is known as an Article 78 review after the civil procedure law provision that created the statutory procedure.