 He was a cousin of James Madison, Jr. (1751–1836), who was a member of the Virginia General Assembly, U.S. Representative in the first four sessions of the United States Congress, and the fourth President of the United States.Both Madisons were heavily involved in the issues of freedom of religion and the separation of church and state.In 1777, Madison served as chaplain of the Virginia House of Delegates and organized his students into a militia company.