After losing the election to Jefferson in 1800, John Adams and congress passed the Judiciary Act of 1801, creating new courts and giving the President the ability to appoint judges. This Frustrated Jefferson, who was an Ant-Federalist.
Marbury v. Madison Feb. 11-24, 1803
Although the appointees were approved by Senate, they were not valid until their commissions were delivered by James Madison. Madison, opposing this act, refused to deliver the commissions.
William Marbury found that his commission had not been delivered by Madison, even though he had been appointed Justice of the Peace in D.C. He therefore petitioned the Supreme Court to force Madison to deliver the documents and a writ of mandamus against Madison.
Although the Court determined that Madisons refusal to deliver the commission was illegal, it also stated that the the Judiciary act of 1789 enabling Madison tho present his claim was in fact illegal, since it was a violation of jurisdiction.
Judge Marshall expanded that a writ of mandamus was legal, but concluded that it was not in the courts power to issue it. He also concluded that the Judiciary act conflicted with the Constitution.
The Aftermath of Marbury V. Madison in short established the principle of judicial review, the power of the supreme court to declare a law unconstitutional.