On July 4, 1831, James Monroe died from heart failure and tuberculosis at his daughter’s house in New York City. The fifth U.S. president had attempted to write an autobiography, but was unable to complete it as his health slowly deteriorated after his wife died the year before.

Thousands of mourners crowded the narrow New York streets to see the 73-year-old’s hearse make its way to the family vault in Marble Cemetery.

With his death came an eerie coincidence that many people couldn’t ignore: Monroe had become the third president and Founding Father to die on the Fourth of July.

Five years earlier, on the 50th anniversary of the Declaration of Independence, longtime friends and occasional rivals Thomas Jefferson and John Adams died.

“Thomas Jefferson survives” were rumored to be among Adams’ last words from his deathbed in Quincy, Mass. He was unaware that his friend died that day, July 4, 1826, at his beloved Monticello estate more than 500 miles away in Virginia.

To many Americans in the early 19th century, the timing of the deaths of three men who helped found and guide the young United States went beyond sheer coincidence.

“Again our national anniversary has been marked by one of those events, which it may be scarcely permitted to ascribe the chance,” the Boston Traveler newspaper wrote on July 8, 1831.

“Three of the four presidents who have left the scene of their usefulness and glory expired on the anniversary of the national birthday, a day which of all others, had it been permitted them to choose [they] would probably had selected for the termination of their careers,” wrote the New York Evening Post the day after Monroe’s death.

Adams served as the second president from 1797 to 1801, followed by Jefferson, who served until 1809. But long before the 13 colonies had won their independence, Adams and Jefferson played vital roles in creating the document that declared men were created equal and entitled to “life, liberty and the pursuit of happiness.”

Adams, in a letter to a friend in 1822, recalled how Jefferson was placed on the committee to write the document. “Mr. Jefferson came into Congress in June 1775 and brought with him a reputation for literature, science, and a happy talent at composition. Writings of his were handed about, remarkable for the peculiar felicity of expression,” Adams wrote.

The irascible Adams also described why he insisted that Jefferson write the draft:

“Jefferson proposed to me to make the draught. I said I will not; you shall do it. Oh no! Why will you not? You ought to do it. I will not. Why? Reasons enough. What can be your reasons? Reason 1st. You are a Virginian, and Virginia ought to appear at the head of this business. Reason 2d. I am obnoxious, suspected and unpopular; you are very much otherwise. Reason 3d: You can write ten times better than I can. ‘Well,’ said Jefferson, ‘if you are decided I will do as well as I can.’ ”

The importance of July 4 might have surprised some Founding Fathers. The Continental Congress declared freedom from Britain on July 2 and approved the Declaration on Independence on July 4. Most members signed the document in August.

Adams thought Americans would remember July 2 as their “Day of Deliverance” from Britain. In a letter to his wife, Abigail, he wrote, “It ought to be solemnized with Pomp and Parade, with Shews, Games, Sports, Guns, Bells, Bonfires and Illuminations from one End of this Continent to the other from this Time forward forever more.”

While Adams and Jefferson represented their states in the Continental Congress, a teenage Monroe dropped out of college in 1776 to fight in the Revolution, enlisting in the 3rd Virginia Regiment, where he rose to the rank of lieutenant colonel. Many historians consider Monroe the last president from the Founding Fathers.

Adams and Jefferson would live to see the country expand well beyond the original 13 states. Adams was 90 when he died of a heart attack. Jefferson had been in declining health for years before dying at 83.

“People interpreted their deaths in a religious manner,” said Michael Meranze, a U.S. history professor at UCLA. “It was clearly taken symbolically as both the birth and growth of the early republic.”

In 1826, for instance, Rep. Daniel Webster of Massachusettsdelivered a two-hour eulogy in Boston suggesting their deaths were a sign that God was protecting the nation.

“As their lives themselves were the gifts of Providence, who is not willing to recognize in their happy termination, as well as in their long continuance, proofs that our country and its benefactors are objects of His care?” Webster said.

Religion played a prominent role in the lives of many Americans during the early 19th century — an era known as the Second Great Awakening that took off around the late 1820s and early 1830s. It was only natural that many Americans of the era saw religious significance in the timing of the deaths of Adams, Jefferson and Monroe.

Although scholars are typically weary of analyzing unexplained phenomena, in 2005 historian Margaret P. Battin entertained the meaning behind the same-day deaths of Adams and Jefferson by offering six possibilities:

Coincidence.

Divine intervention.

“Hanging on” to life to ensure death on July 4.

Caused to die by others.

Allowing oneself to die.

Causing oneself to die.

Each of these theories, she said, lacks historical evidence.

It’s been 186 years since the last U.S. president died on the Fourth of July. And history tells that only one president was born on the nation’s birthday: Calvin Coolidge in 1872.

melissa.etehad@latimes.com

Twitter: @melissaetehad