Lawmakers in Greece have approved a proposal to allow candidates in upcoming European elections to retain their seats in the national parliament — an amendment needed to preserve the government's razor-thin majority.

Two independent lawmakers backing left-wing Prime Minister Alexis Tsipras are expected to run in the May 26 European election but their departure could have toppled the government. Amid strong protest from opposition parties, lawmakers voted 148-105 Wednesday to change the rules.

Tsipras' government narrowly avoided collapse in mid-January following the departure of a nationalist coalition partner. But six independent members of parliament rescued the government, pledging support and giving Tsipras the backing on 151 lawmakers in the 300-seat legislative assembly.

The coalition collapse was triggered by a landmark agreement between Greece and neighbor North Macedonia to normalize relations.