Secret Service Director Mark Sullivan testifies before the Senate Homeland Security and Governmental Affairs Committee about the prostitution scandal May 23, 2012 in Washington, D.C. (Chip Somodevilla/GETTY IMAGES)

Secret Service Director Mark Sullivan, who oversaw the agency during tumultuous and challenging times, is retiring Feb. 22 after nearly 30 years of service, the agency said Friday.

Sullivan has led the agency that protects the president since the second half of President George W. Bush’s second term. He oversaw President Obama’s 2009 inauguration, which drew more than a million people to Washington, and nearly two dozen other major events involving the president.

His nearly seven years as head of the Secret Service make him the agency’s third-longest-serving director.

In his last year, Sullivan had to confront a prostitution scandal involving numerous Secret Service agents preparing for Obama’s arrival in Colombia.

He was forced to publicly apologize in Congress for the conduct of his agents, saying that it was an isolated experience that did not put the president at risk.

Sullivan said the employees involved “did some really dumb things” and their behavior “is not representative of these values or the high ethical standards we demand.”

That episode followed another controversy earlier in Obama’s first term when Tareq and Michaele Salahi breached security at a White House event and mingled with Obama and Vice President Biden.

Beyond those two setbacks, Sullivan has had a record relatively free of major controversies, spending time in the Secret Service’s presidential protective unit and its anti-counterfeit unit, among other areas.

“From securing large events such as Presidential Inaugurations to safeguarding our financial system, the men and women of the agency perform their mission with professionalism and dedication,” Obama said in a statement. “That is a testament to Mark and his steadfast leadership, which will be missed.”

Obama will select a replacement in consultation with Department of Homeland Security Secretary Janet Napolitano. The Secret Service director does not need to be confirmed by the Senate.