The French government of President Emmanuel Macron on Tuesday was battling to salvage a flagship immigration reform following deadlock in parliament that risks casting a shadow over his second mandate.

After the government bill was rejected by parliament last week, a commission of French lower house MPs and upper house Senators began work on Monday to find a compromise text. They suspended their session after midnight without a breakthrough before resuming in the morning.

The government regards the legislation -- which generally tightens immigration rules -- as crucial to seizing the initiative on the issue from the far-right.

Interior Minister Gerald Darmanin, the ambitious 41-year-old who has spearheaded the legislation, warned on Sunday that far-right figurehead Marine Le Pen risks winning the 2027 presidential election if the bill is not passed.

Passing the legislation is also critical for Macron who cannot stand again in 2027 after two consecutive terms and is extremely wary of being seen as a lame duck with over three years left of his final mandate.

The mixed commission was due to resume work in the morning with tensions between the centrist government and the opposition right-wing Republicans proving to be the main sticking point.

"I think we are going to have an agreement, I hope so, we are doing everything for it" but "not at any price, not under any conditions," Darmanin told France 2 television.

- 'Won't give in' -

The chief obstacle is that the right wants to make social security benefits for foreigners conditional on five years of presence in France or 30 months for those who work. But Macron's faction does not want these restrictions in the legislation.

"The government wants to distinguish between those who work and those who do not work," said Darmanin. "This is a line that is very important for us and we will not give in on it."

Members of the right-wing and left-wing opposition last week joined forces to vote down the draft without even debating the measures. The government does not have a majority in parliament following 2022 elections.

If there is a compromise on the text, the bill will be put to a vote on Tuesday evening, first in the upper house Senate and then the lower house National Assembly.

Yet even if the parliamentary commission agrees on a compromise text, there is no guarantee it would not again face obstacles in the National Assembly.

The government has over the last year frequently used constitutional powers to pass legislation without a vote as it did with contested pension reforms.

But this could also trigger a confidence motion that it could lose.

"The political crisis around the immigration bill is a moment of truth where all the fragilities of Emmanuel Macron's mandate are coming together," the Le Monde daily said in an editorial.

Advocacy groups have criticised the bill, arguing for better conditions for migrants who power many industries in France.

Originally proposed by Macron's centrist government with a mix of steps to expel more undocumented people and improve migrants' integration, the draft law was hardened during its earlier passage through the upper house, which is controlled by the right.

The current version has nonetheless been criticised by both the far right and the far left for opposing reasons.

France's immigrant population is estimated at 5.1 million, or 7.6 percent of the population. Authorities believe there are between 600,000 to 700,000 undocumented immigrants in the country.