Guatemala’s highest court ruled Tuesday that President Jimmy Morales could not expel the leader of a United Nations anticorruption panel that has accused him of breaking campaign finance laws.

The decision by the Constitutional Court confirms an earlier temporary ruling and and heightens political pressure on Mr. Morales to allow the work of the commission and its head, Ivan Velásquez, to go forward, even though the president is now a target of its investigations along with many other politicians and powerful business leaders.

The president’s surprise announcement on Sunday that he was expelling Mr. Velásquez created political upheaval, prompting protests in defense of Mr. Velásquez and condemnation from the United Nations, the United States and other countries.

“The government must decide if it is fighting against corruption or not,” the United States ambassador, Todd D. Robinson, told a Guatemalan newspaper on Monday. Mr. Robinson has been an outspoken supporter of the anticorruption battle led by Mr. Velásquez and Attorney General Thelma Aldana.