SEOUL, South Korea — South Korea’s top prosecutor resigned Friday after a wave of scandals and public infighting in his office. The resignation of the prosecutor, General Han Sang-dae, was quickly accepted by President Lee Myung-bak, who urged the nation’s prosecutors to undertake “self-reflection” and “reform to restore the trust of the people.”

For weeks, the Supreme Prosecutors’ Office has been embarrassed by a series of scandals. Early in November, a senior prosecutor named Kim Kwang-joon was arrested on charges of accepting $826,000 in bribes from a conglomerate and from the alleged mastermind behind a Ponzi scheme. Days later, it was revealed that a junior prosecutor had had sex in his office with a female suspect he had been questioning on theft charges.

Amid the uproar over those episodes, another prosecutor issued a public call for thorough reform in the agency — but, in a text message meant for a friend that became public after he mistakenly sent it to a reporter, wrote that he was merely paying lip service to the idea in hopes of appeasing the public and the news media.

A survey released this week by a government anticorruption panel found that South Korea’s law enforcement authorities — prosecutors, the police and the Justice Ministry — were viewed as the most corrupt arms of the government.