A mandamus is an order to a public agency or governmental body to perform an act required by law when it has neglected or refused to do so. A person may petition for a writ of mandamus when an official has refused to fulfill a legal obligation, such as ordering an agency to release public records.