MADRID — Spain’s government on Wednesday moved to block the latest attempt by separatist legislators in Catalonia to re-elect Carles Puigdemont as the region’s leader, even as he fights extradition from Germany.

The government asked Spain’s Constitutional Court to declare invalid a Catalan law approved recently by separatist legislators that could have allowed Mr. Puigdemont to be voted into office in absentia and then read his acceptance speech by videoconference from Germany. After the government’s appeal, the Constitutional Court immediately suspended the Catalan law and warned separatist lawmakers against holding any vote that would violate that order.

Mr. Puigdemont is fighting extradition for trial in Spain while trying to remain the main protagonist in the politics of Catalonia and the standoff with the Spanish government of Prime Minister Mariano Rajoy.

Catalan lawmakers must elect a new leader for their regional government by May 22 to avoid a new election, after months of political deadlock. The standoff followed an election last December, which was called by Mr. Rajoy but failed to deliver the result that he had sought. Instead, the three main separatist parties managed to retain a narrow majority in the regional Parliament, with an almost identical 47.5 percent of the votes that they received in the previous election in 2015.