Nigel Farage and Beppe Grillo, the bombastic head of Italy’s anti-establishment Five Star Movement (M5S), plan to continue their alliance in the European parliament despite an embarrassing rupture earlier this week, according to a statement by the former Ukip leader.

The move offers Farage a lifeline in Brussels, because the departure of M5S’s MEPs could have led to Ukip losing some of its funding in the European parliament.

The two Eurosceptic leaders appeared to have made amends less than 24 hours after liberal members of the European parliament rejected an attempt by Grillo – who had publicly dumped Farage – to join a more powerful grouping, the Alliance of Liberals and Democrats for Europe (ALDE).

Ukip's EU funding at risk after M5S quits Nigel Farage's Brussels group Read more

Grillo’s initial move to join ALDE was blessed by the liberal group’s leader, Guy Verhofstadt, who is running for the presidency of the European parliament and could have benefited from the new alliance, but it was quashed by dissenting ALDE MEPs who rejected the alliance because of differences on key European issues.

On Tuesday Diego Destro, a spokesman for M5S’s MEPs, confirmed the party was sticking with Farage’s grouping, the Europe of Freedom and Direct Democracy.

Farage, who on Monday lambasted Grillo’s decision to abandon their joint grouping and accused him of joining “the Euro-fanatic establishment”, said he was happy to have resolved the matter and that the group would continue to work together after a few unspecified administrative changes.

“The Grillo campaign for a referendum on Italy’s membership of the euro is gaining momentum. I have long admired his work in Italy and wish him well,” Farage said. “The anti-establishment campaign in Europe is really just starting.”

The deal brings to an end a tumultuous 48 hours for Grillo, who had praised Farage and Brexit in his farewell letter to the Ukip leader on Monday, but said he thought M5S’s aims were better served in the liberal and pro-Europe ALDE.

The humiliating debacle could still haunt the head of M5S. The party has said it believes in direct democracy, and in an online poll about 80% of voters said they supported leaving Farage’s group. After liberal MEPs rejected the new alliance, Grillo wrote on his blog that it was a blow wrought by the establishment.

“We shook the system like never before,” Grillo wrote. He also promised to create a new party in the next parliament.