WASHINGTON — Former President Barack Obama and former first lady Michelle purchased the home here that they have been renting, the Sun-Times has learned, closing on the $8.1 million purchase on Wednesday.

Obama spokesman Kevin Lewis confirmed the sale, telling the Sun-Times, “Given that President and Mrs. Obama will be in Washington for at least another two-and-a-half years, it made sense for them to buy a home rather than continuing to rent property.”

A source familiar with the situation said the Obamas will continue to own their Chicago home in the South Side Kenwood community.

The Obamas decided to stay in Washington after leaving the White House on Jan. 20 until youngest daughter Sasha finishes high school. She will start her junior year of high school at Sidwell Friends in the fall.

The 8,200-square-foot home in the historic Kalorama neighborhood was owned by former Clinton White House press secretary Joe Lockhart and his wife, Giovanna Gray Lockhart.

According to property records filed with the District of Columbia Recorder of Deeds, the Lockharts sold their mansion for $8.1 million to an Obama entity, Homefront Holdings, LLC.

Lockhart and Gray, who was Glamour Magazine’s Washington editor, moved to New York where Lockhart is the National Football League’s executive vice president for communications.

The house was sold for $5.295 million on May 12, 2014.

Last year, the Washington Fine Properties listing for the mansion described it as a “historic 1920s residence situated on an oversized home site. This 2011 meticulous renovation & substantial addition features gracious public rooms, 8-9BR/8.5 spa baths w/exquisite finishes, fully finished lower level w/au-pair suite, and approx. 8,200 finished sq.ft. Stunning oversized terrace/formal gardens, 2 car gar parking & gated courtyard for 8-10 vehicles.”