The doctrine of exhaustion of remedies prevents a litigant from seeking a remedy in a new court or jurisdiction until all claims or remedies have been exhausted (pursued as fully as possible) in the original one. The doctrine was originally created by case law based on the principles of comity.
In the United States, exhaustion of remedies is applied extensively in administrative law. Many cases are handled first by independent agencies of the United States government which have primary responsibility for cases involving the statutes or regulations which the agency administers.
A person's specific rights and duties depend on the federal statute involved, but here is an outline of how the doctrine works in practice. "Exhaustion of administrative remedies" requires a person to first go to the agency which administers the statute; this process usually involves filing a petition, then going to a hearing, and finally using the agency's internal appeal process. Once the agency's own procedures are finished, or "exhausted", then the aggrieved person can file a complaint in a federal court. But the doctrine of exhaustion of remedies prevents parties from seeking relief in the courts first.
The same process is required under the laws of many, if not all, states.
Exhaustion of remedies frequently affects cases of habeas corpus. Federal law, for example, prevents a petitioner from seeking federal relief where the state claims have not yet been exhausted. Generally, the exhaustion requirement permits state courts a "...meaningful opportunity to consider the allegations of legal error." 
The issue of exhaustion of remedies in a criminal law case was before the United States Court of Appeals for the Fourth Circuit in Harvey v. Horan.