John Adams was defeated by Thomas Jefferson in the U.S. election for President in 1800. One of the last acts of congress before the newly elected body took over was to pass the Judiciary Act of 1801. Among other things it modified the number of circuit courts, changed the number of Supreme Court justices, and created 10 new District Courts. Two days before the end of his term, Adams appointed circuit judges and justices of the peace (something else the Judiciary Act allowed him to do) to cover the new positions. A day later the Senate approved all of the appointments, but the commissions had to be hand delivered to the appointed. Some of them were not. After being sworn in, the new president ordered a halt to the delivery of the new commissions. One of the men involved was William Marbury. Jefferson's new Secretary of State was James Madison.
The new congress engaged in some trickery and reinstated the previous Judiciary Act as well as "canceled the Supreme Court term scheduled for June of that year....seeking to delay a ruling on the constitutionality of the repeal act until months after the new judicial system was in operation." (Wikipedia linked below).
Marbury filled a write of mandamus in the Supreme Court without working his way through district or state courts. Marshall's court had to decide if the Supreme Court had original jurisdiction over the case (so that the court could hear it). Marbury argued that the Judiciary Act of 1789 (the original) gave the Supreme Court the requisite original jurisdiction at dispute.
Marshall's court had to decide if Article III of the constitution gave congress a list for original jurisdiction and how (if at all) congress can add to that list. If not, and congress attempts to add to the list anyway, what wins....the constitution or the statute? More importantly who decides the winner?
In the written opinion, Marshall rules that Marbury has the right to his commission under the constitution and that Jefferson should have delivered it, as the law says he should. However, he also writes that congress does not have the authority under the constitution to add to Article III of the constitution by statute. Thus, the court finds the Judiciary Act of 1789 unconstitutional.
Marshall could have just ordered Jefferson to deliver the commission, but what recourse did the court have if Jefferson refused? Absolutely none. So, instead the Chief Justice found a law passed by congress to be unconstitutional, a decision that really had no precedence in the constitution...the constitution says nothing about the legality of Judicial Review. Instead of engaging in a showdown with hostile president, Marshall finds a reason in Judicial Review to refuse Marbury's request even though he finds that Marbury has a case against the President.
Because of Stare decisis (a common law term meaning, so I've been told, "Let the Decision Stand), the Supreme Court and other courts have had the right to review laws passed by congress to make sure they pass constitutional muster....which is not in any way established by the constitution.
Read more at the Wikipedia site located at:
http://en.wikipedia.org/wiki/Marbury_v._Madison.