The White House, U.S. Capitol and other federal buildings in Washington, D.C., were ransacked and torched by British troops on this day in history, August 24, 1814.

The shocking attack on the very heart of American sovereignty marked the depths of the War of 1812 for the United States — arguably the lowest point in the history of the nation. 

President James Madison and first lady Dolley Madison fled the capital separately, returning days later to find the city in ruins. 

"One hundred fifty men smashed windows and piled White House furniture in the center of the various rooms," wrote Thomas Fleming in his 2009 book "The Intimate Lives of the Founding Fathers," an excerpt of which appeared in Smithsonian Magazine.

ON THIS DAY IN HISTORY, AUGUST 19, 1812, OLD IRONSIDES LEGEND BORN IN SMASHING VICTORY OVER ROYAL NAVY

"Outside, 50 of the marauders carrying poles with oil-soaked rags on the ends surrounded the house," added Fleming. 

"At a signal from the admiral, men with torches ignited the rags, and the flaming poles were flung through the smashed windows like fiery spears."

British troops ate food and drank wine left on the White House dinner table while parading around with the president's hats stuck on bayonets. 

White House burned by British

This undated wash drawing shows the burning of Washington, D.C., by the British in 1814. The White House can be seen in the background. (Getty Images)

"The ensuing fire reduced all but one of the capital city's major public buildings to smoking rubble, and only a torrential rainstorm saved the Capitol from complete destruction," states the official version of events by the U.S. Senate.  

Dolley Madison famously ordered staff to help her save a treasured portrait of George Washington from the hands of the British. 

MEET THE AMERICAN WHO WROTE ‘THE BATTLE HYMN OF THE REPUBLIC’

The confident young nation had declared war on Great Britain in 1812, in response to repeated violations of American maritime rights, just 36 years after declaring independence — and just 23 years after the nation was formed as a constitutional republic.

"The burning of the public buildings by the British was a humiliating defeat that struck at the symbolic heart of the country," the White House Historical Association notes. 

First Lady helps save Washington protrait

1814: Dolley Madison, wife of President James Madison, rescues a portrait of George Washington from the White House before British troops set fire to the building during the War of 1812. A print by A Bubbett.  (MPI/Getty Images)

Yet it also notes, "Up from the ashes of that bitter blow, a resilient nation emerged stronger and more unified."

Among other responses: American troops survived the horrific bombardment of Fort McHenry by the British navy just three weeks later. 

This stunning show of American resolve inspired Francis Scott Key to pen a poem of national survival and resilience.

It was this stunning show of American resolve against all odds, while the nation's capital lay in ruins just 40 miles away, that inspired Francis Scott Key to pen a poem of national survival and resilience, proudly exclaiming "our flag was still there." 

The "The Star-Spangled Banner" became the national anthem in 1931. 

The attack on Washington also reshaped the future of the national library.  

American flag illustration from 1941

This screen print illustration from 1941 depicts an American flag flying over Fort McHenry, based on Francis Scott Key's national anthem, "The Star-Spangled Banner." (GraphicaArtis/Getty Images)

"The congressional library, then housed in the Capitol’s north wing, was destroyed," the Library of Congress reported in 2015. 

"To ‘replace the devastations of British vandalism,’ former U.S. President Thomas Jefferson offered to sell his personal collection of books, the largest and most comprehensive in the United States at that time."

The Library of Congress went on, "With some reservations, Congress purchased his library for $23,950 in 1815. Jefferson’s belief that democracy depended on free access to knowledge eventually ensured the availability of the Library’s rich collections not only to Congress, but also to this nation and the world." 

The Library of Congress Thomas Jefferson Building.

The Thomas Jefferson Building at the Library of Congress in Washington, D.C. Jefferson's books formed the core of the present collections of the Library of Congress (the world’s largest library), the Library has noted. (LOC/Carol M. Highsmith)

The attack on Washington, D.C., was shaped by wider events in the decades-long global war between Great Britain and France — including Napoleon's famously failed effort to invade Russia. 

ON THIS DAY IN HISTORY, AUGUST 22, 1776, THE BRITISH INVADE BROOKLYN BY SEA

The emperor was defeated outside Moscow in the autumn of 1812 and began his retreat westward. Britain and allied forces pounced on the emperor's weakness and captured Paris in March 1814. 

Napoleon abdicated the throne and was sent into exile in April. It freed up British forces to concentrate on the conflict with the United States. 

"It was not until 1817 that newly elected president James Monroe moved back into the reconstructed [White House] building."

The president solemnly predicted those forces would bear down on D.C. 

"I am just possessed of the intelligence last from Great Britain," President Madison wrote to Secretary of War John Armstrong on May 20, according to the White House Historical Association. 

CLICK HERE TO SIGN UP FOR OUR LIFESTYLE NEWSLETTER

"They admonish us to prepare for the worst the enemy may be able to effect against us ... Among these [targets], the seat of Government cannot fail to be a favorite one."

A force of about 4,000 British troops landed in Benedict, Maryland, on the shores of the Patuxent River, on Aug. 19. 

Says History.com of the attack, "Although President Madison and his wife were able to return to Washington only three days later when British troops had moved on, they never again lived in the White House."

CLICK HERE TO SIGN UP FOR OUR LIFESTYLE NEWSLETTER

"Madison served the rest of his term residing at the city’s Octagon House. It was not until 1817 that newly elected president James Monroe moved back into the reconstructed building."