Flush from his success from being an important and valued member of the Virginia Convention, Madison ran for state-level office in the spring of 1777. He lost his first election due to the fact that he was not an effective campaigner . . . he didn't buy enough rounds of drinks in his district to get people to vote for him! Madison learned that too much pride can be detrimental (he thought buying drinks was "beneath him"), and also that losing an election is not the same thing as losing a political argument; those would be important lessons down the road.
From 1777 - 1783, Madison served as a representative to the National Government (basically the Legislature of the Articles of Confederation), and due to his close-up view, Madison was able to analyze the problems inherent of a confederation. Due to term limits, he had to vacate his seat, and was selected as a representative of the "Governor's Council", which was also seated in the nation's capital, until he was able to win another election as a representative from his district. During his involvement in national politics during the Revolutionary War, Madison supported the Treaty of Alliance (1778) with France, so much so that he became an avowed Francophile.
In June, 1779, Thomas Jefferson was elected Governor, and unlike Henry, Jefferson recognized and appreciated Madison's talents. If Jefferson and Madison were not working together, they wrote each other. They were bound together by their similarities (e.g. books) as well as their differences (TJ was the visionary, while Madison was the pragmatist). They both benefited tremendously from their personal and political friendship; Jefferson very much needed Madison's practicality to balance his idealism.
James Madison finally met General George Washington in person in the Winter of
1781-1782 in Virginia. Washington decided to bring the talented young up-and-coming Virginian into his circle of advisors, where he appreciated Madison's advice and humor.
Madison met Alexander Hamilton in November, 1782 in the national legislature as a fellow Congressman. They initially drew together over money and reform issues, but they disagreed on the strategies for reform. Both were geniuses, but Madison was far more circumspect, while Hamilton liked to tell anyone and everyone what was on his mind.
After the Revolutionary War, America had won its political independence, but it started life as a as a "deadbeat" nation, not even trying to pay back fractions of the loans from Dutch banks and the government of France. While Alexander Hamilton gravitated towards economic matters and the soon-to-be-proposed executive, Madison had moved to the center of national politics, and was learning how to be a politician . . . something that Hamilton never figured out. In the pitched political battles of the early-1790s, Hamilton understood America's economic reality, while Madison viewed the struggles of the nation through a political lens.
Before Jefferson left for Paris, Madison and Jefferson steered a bill into law in Virginia, guaranteeing religious freedom - it was the precedent for the "Separation of Church and State." Later in 1784, Madison teamed up with Washington on what he called the "Potomac Project", trying to link the population of the coastline inland via the river. Madison actually thought that the Mississippi River was more important than the Potomac, but he wanted to get closer to Washington. As a result, Madison was Washington's "Right Hand Man" in the Virginia legislature for the project - he had reached a point of such importance in Washington's life that Madison was invited to Mount Vernon in the Fall of 1785. As time went by, the most common job that Madison performed for Washington was that of Ghost Writer (he wrote Washington's Farewell Speech . . . for 1793, at the end of his first term).
In 1786, a convention in Annapolis was scheduled to discuss commerce concerning the Articles of Confederation - delegates from only five states attended. But, among those delegates were James Madison and Alexander Hamilton, and they pulled a political "fast one." They scheduled another convention to be held in Philadelphia in 1787, and then left town so there couldn't be any debate on the matter. In issuing the call for another convention, Madison made sure that the statement appealed to the ruling political class as well as the general public, something that was anathema to Hamilton. To those around him (e.g. Jefferson), Madison compared the Articles of Confederation to the failed political systems in Europe; he thought that there must be a way to bring order out of chaos . . . legitimate, recognized authority was needed at the national level.
Madison was the primary author of the "Virginia Plan"; Randolph presented the plan to the attending delegates on the third day of the convention. Madison believed in majority rule that featured some coercive, legitimate authority. After Randolph presented the plan (and ruffled a few feathers in the process), Madison led the struggle to gain its passage. The only steady ally that Madison found was James Wilson of Pennsylvania; he continued to support Madison on many issues during the Constitutional Convention. However, William Paterson's "New Jersey Plan" (maintaining the status quo of the A of C) appealed to the smaller-population states.
On 16 July, 1787, the "Great Compromise" was negotiated, which basically combined the major elements of the Virginia and New Jersey Plans. Packaged with that compromise was the "Three-Fifths Compromise", establishing a formula for African slaves in terms of representation in the new (federal) "Lower House." Madison was the most dispirited and disappointed of all the Virginia delegates, but he kept going (and complaining), trying to save something from what he considered a political wreck. Again, he applied the lesson that losing his goal of representation based on population did not mean that he had lost his goal of extending the sphere and influence of a new national government.
Madison's main motivation to take copious notes of what was discussed and done at the Constitutional Convention (he agreed that he would not publish them any time soon) was to use the information from the notes in the future for political purposes, in private . . . the "Father of the Constitution" was already morphing into the "Father of Politics." Madison, Hamilton and Gouverneur Morris of Pennsylvania (one of the few that was respected and admired by virtually all of the other delegates) were tasked with writing the final draft of the Constitution - Morris was responsible for writing the Preamble.
On 17 September, 1787, George Washington gave his seal of approval of the document, albeit by indirect means. While the convention was in session, he was basically unable to directly participate in the floor debates (he participated and influenced much outside the sessions), so he, through a motion on the floor, gave his "indirect" blessing, and the Constitution was signed.
Ratification in Virginia was fraught with difficulty from the beginning. George Mason, an original supporter, stated that he would refuse to attend the Ratification assembly, and campaigned against the document. Mason believed that the proposed Executive (President) had too much power at the expense of the Legislative branch, and the states. Edmund Randolph was also against Ratification, but Madison was able to work his political magic (in private), and Randolph was in public support, at least.
In New York, Ratification was more difficult than in Virginia; Governor George Clinton was "all-in" against the proposed Constitution. He wanted New York to continue as a semi-sovereign state, which he believed would be impossible with a more powerful national government. In response, Hamilton wrote his first Federalist Essay, which was the start of a propaganda blitz supporting the Constitution in the nation's newspapers. Hamilton wrote five essays, and John Jay wrote four, but Jay started to suffer from rheumatoid arthritis, and Hamilton asked his political ally, James Madison, to join him. Since Madison and Hamilton lived close to each other in New York City (they were both still representatives), it was easy to collaborate. In his twenty-nine Federalist Essays, Madison consistently argued that the sphere of the national government's influence should be extended. Unlike Hamilton, Madison needed to learn how to be a journalist, writing quality product while meeting deadlines; like he had done, and would continue to do, Madison stepped up and mastered a brand new (academic) skill.
2 June, 1788, the Virginia Convention convened; among the delegates were two soon-to-be significant historical figures: John Marshall (for) and James Monroe (against).
Patrick Henry held the floor for approximately one-quarter of the convention, opposing Ratification. Henry's ally, George Mason, made the mistake of making a motion that the delegates should analyze each clause of the Constitution, which then gave the advantage to James Madison (and his giant brain). But, Madison, the politician, could see that the tide for a Bill of Rights was irresistible, so he compromised on that point . . . but which rights to include, and where in the document should they be listed?
Even though New Hampshire became the ninth state to ratify the Constitution, it would have been a relatively meaningless document without the support of Virginia and New York.
The votes were close in both state's Ratification conventions: in Virginia, the vote to ratify was 89-79, and in New York, it was 30-27.
(Below: Richard Brookhiser narrates a short video on James Madison and the Constitution)