Obama and Pfeiffer (AP Photo/Charles Dharapak, File)

Dan Pfeiffer, one of President Obama's closest and most trusted advisers, is leaving the White House within weeks.

Pfeiffer is one of the president's longest-serving aides, having joined Obama during his 2008 presidential campaign. The White House said he will leave in early March.

“Dan has been beside me on every step of this incredible journey, starting with those earliest days of the campaign in 2007, " Obama said in a statement. "And through it all, he’s been smart, steady, tireless and true to the values we started with. Like everyone else in the White House, I’ve benefited from his political savvy and his advocacy for working people.  He’s a good man and a good friend, and I’m going to miss having him just down the hall from me."

The New York Times first reported that Pfeiffer will leave the White House.

Pfeiffer is one of a very tight circle of Obama aides, often criticized as being too insular, who helped the president win elections and pave the way for passage of the health care law and signing of executive actions on immigration.

He was instrumental in helping push forward the White House's social media strategy, becoming one of the first officials to blog and pushing to grow the administration's presence on networking sites such as Instagram and Twitter. An administration official said Pfeiffer has recently been spearheading a review of the White House communications structure.

Pfeiffer told Obama that he planned to leave the day after the State of the Union, as the president was flying to Boise, Idaho. A White House official said Pfeiffer has been mulling his next move for some time and feels that the White House is strong, allowing him the space to move on.

Pfeiffer is one of a number of trusted Obama aides who have announced their departures in recent weeks - changes that often happen in the second half of a president's second term. White House Counselor John Podesta will leave this month to help Hillary Clinton's presidential campaign, should she run. Ronald Klain, who Obama named Ebola czar last year, will step down Feb. 15.