The head of the United Nations agency that aids Palestinian refugees resigned on Wednesday, the United Nations said, amid an investigation into allegations of misconduct.

The agency’s leader, Pierre Krahenbuhl, had been replaced earlier in the day while a review of “management-related matters” was pending. Mr. Krahenbuhl then told Secretary-General António Guterres that he would resign immediately, United Nations spokesman Stephane Dujarric said.

The agency, formally known as United Nations Relief and Works Agency for Palestine Refugees, aids more than five million registered refugees in the West Bank, Gaza Strip and East Jerusalem, as well as in Jordan, Lebanon and Syria.

Mr. Krahenbuhl was notified in March that an investigation was underway based on allegations of “unsatisfactory conduct,” an agency spokeswoman said. Mr. Krahenbuhl, a Swiss national who took over the United Nations post in 2014, had previously been director of operations at the International Committee of the Red Cross.