MEXICO CITY  Guatemala’s constitutional court has removed the nation’s embattled attorney general, appearing to head off a growing political crisis in a country besieged by organized crime and corruption.

In its ruling on Thursday, the court did not directly address accusations that Attorney General Conrado Reyes had links to organized crime but said the ruling was necessary so that “illegal groups” could not “harm the constitutional process” that led to his selection.

Since he was appointed attorney general on May 25, Mr. Reyes had faced questions over his past. On Monday, the head of a United Nations panel charged with fighting corruption and impunity in Guatemala resigned in frustration, citing the appointment of Mr. Reyes, who he said had links to drug traffickers and illegal adoption rings.

Mr. Reyes has denied the charges but said Thursday that he would abide by the court’s ruling.

President Álvaro Colom, who appointed Mr. Reyes and has been under pressure to find a way to remove him, said he was “satisfied” with the ruling.