image sourceGetty Imagesimage captionCritics of the president have long accused him of authoritarian tendencies
El Salvador's top court has ruled that presidents can serve two consecutive terms, paving the way for leader Nayib Bukele to seek re-election in 2024.
The judges behind the decision were appointed in May after the National Assembly, dominated by the president's party, sacked the previous justices.
The electoral tribunal said it would follow the Supreme Court's order.
The ruling has been criticised by the opposition and activists, who accuse Mr Bukele of authoritarian tendencies.
The 40-year-old president was elected in February 2019 on a promise to tackle rampant gang violence and political corruption, and remains hugely popular in the impoverished Central American nation.
The ruling, handed down late on Friday, ordered the country's electoral body to allow a president who had not been in office "in the immediately preceding period to participate in the electoral contest for a second occasion".
Anabel Belloso, a National Assembly member for the opposition Farabundo Martí National Liberation Front, said: "The state ceased to be at the service of the people and passed to be at the service of one person".
José Miguel Vivanco, executive director of the Americas division of Human Rights Watch, condemned the ruling, saying El Salvador was heading down a path taken by Nicaragua and Honduras in allowing presidents to be re-elected.
"Democracy in El Salvador is on the edge of the abyss," said Mr Vivanco, a critic of President Bukele.
The president has drawn rebukes from Washington for his constitutional changes and curbs on his critics in the media. Opponents accuse him of undermining El Salvador's separation of power and its system of checks and balances.
His New Ideas party won a congressional majority in February and, months later, replaced five Supreme Court judges and the independent attorney general.
Last year, the president sent the military into the country's parliament during a vote on the security budget, which opponents said was a deliberate attempt at intimidation.