Hungary's President Tamas Sulyok has avoided the prospect of impeachment by signing legislation ejecting him from his own post, as the fall-out of Prime Minister Peter Magyar's Tisza party landslide election victory in April continues to change the country's political landscape.

The amendment, passed with a majority last Monday, ends the president's term citing "serious loss of confidence" in him.

Sulyok confirmed he would agree to step down, but accused Magyar's government of violating the rule of law.

He said in a statement that the amendment marked a "breaking point in Hungarian constitutional democracy" and said the "core values of a free society ... have been trampled underfoot for the sake of political power".

"It sets a negative precedent that inflicts a deep wound on the constitutional values of democracy," he added.