Barack and Michelle Obama have snapped up the 1920s brick house they were renting in the posh Washington, D.C., neighborhood of Kalorama for $8.1 million.

The former president and his family plan to spend at least another two-and -a-half-years in the nation’s capital, said Kevin Lewis, spokesman to the Obamas.

"It made sense for them to buy a home rather than continuing to rent," Mr. Lewis said in an email confirming the purchase.

More: Read how Trump top adviser Kellyanne Conway is hoping to turn her D.C. home into a social hub

The Obamas have been living in the 8,200-square-foot home since leaving the White House in January. Mr. Obama, 55, has said in the past that the family intends to stay in Washington, D.C., until their youngest daughter, Sasha, finishes school.

The house was renovated in 2011, includes up to nine bedrooms, eight-and-a-half bathrooms, a finished basement with room for staff, an oversized terrace and formal gardens, according to a former listing with Washington Fine Properties. There’s also a two-car garage plus ample parking for a Secret Service detail in a gated courtyard that can fit eight to 10 cars.

More: Click to see how the Obama library in Chicago is already raising the home values in the nearby neighborhoods

The sellers, Joe Lockhart, Glover Park Group co-founder, and his wife, Giovanna Gray Lockhart, the Washington editor of Glamour, bought the home in 2014 for $5.3 million, according to property records.

Kalorama is a popular spot for D.C. elite. Mr. Obama’s neighbors include top adviser to President Donald Trump Jared Kushner and his wife, Mr. Trump’s daughter Ivanka Trump, as well as Secretary of State Rex Tillerson.

The Washington Post first reported the sale.