It happened in the late summer of 1814. We Brits duffed over the Americans at the Battle of Bladensburg, the UK force led by one Major General Robert Ross.
They set fire to multiple government and military buildings, including the White House (then called the Presidential Mansion), the Capitol building, as well as other facilities of the U.S. government - shame they hadn't gone further.
The attack was in part a retaliation for the recent American destruction of Port Dover in Upper Canada, so the Americans got the come-uppance - the Burning of Washington marks the only time since the American Revolutionary War that a foreign power has captured and occupied the capital of the United States.
It was James Madison who held the PoTUs and he bunked out of the capital, no secret service needed to carry him out. They eventually found refuge for the night in Brookeville, a small town in Montgomery County, Maryland, which still is known today as the "United States Capital for a Day".