Nigel Farage has quit Ukip after 25 years, saying the party he led to its greatest election successes was now unrecognisable because of the “fixation” with the anti-Muslim policies of its leader, Gerard Batten.

Farage, who took Ukip to third place by number of votes in the 2015 election and significantly shaped the ground for the Brexit referendum, said he was dismayed by Batten’s policies and his decision to appoint the far-right campaigner Tommy Robinson as an adviser.

Writing in the Daily Telegraph, Farage condemned Batten’s decision to throw Ukip’s support behind an anti-Brexit demonstration in London on Sunday organised by Robinson and his associates, saying it was likely to “inspire violence and thuggish behaviour”.

“My heart sinks as I reflect on the idea that they may be seen by some as representative of the cause for which I have campaigned for so much of my adult life,” wrote Farage, who regularly contributes a column to the newspaper. “The very idea of Tommy Robinson being at the centre of the Brexit debate is too awful to contemplate.

“And so, with a heavy heart, and after all my years of devotion to the party, I am leaving Ukip today. There is a huge space for a Brexit party in British politics, but it won’t be filled by Ukip.”

Farage, who tried and failed seven times to become a Ukip MP and is still an MEP for the party, has repeatedly criticised Batten’s focus on anti-Muslim policies and rhetoric, and warned at the weekend that he might quit.

Amid wider discontent at the stance of Batten, who has described Islam as a “death cult” and called for policies including Muslim-only prisons, Ukip’s national executive met at the weekend to consider his future as leader.

While members made it clear that they did not want to allow Robinson to join Ukip – as the founder of the far-right English Defence League, he is barred under current rules – a vote of no confidence in Batten was defeated.

Farage’s announcement is likely to prompt a further wave of departures from Ukip, which has lost three MEPs in recent weeks over its new direction. Many of those who opposed Batten’s views had hoped that the former leader, who quit after the Brexit referendum, could return if Batten was ousted.

Since stepping down as party head, Farage has forged a career as a political pundit, both in the UK and US. In the latter he has been slightly less discriminating, for example on the far-right website Infowars, which propagates conspiracy theories and has argued that the 7 July attacks in London were faked.

During an appearance on Infowars earlier this year, Farage told host Alex Jones that leftwingers in Europe were “allied with radical Islam” and “want to abolish the nation state”.

After Farage left the leadership, Ukip rapidly began a spiral of decline. His immediate successor, Diane James, left the post after 18 days. Her replacement, Paul Nuttall, was dogged by questions over his claimed biography and left after a disastrous 2017 election for the party.

The next leader, Henry Bolton, was forced out in a members’ voter over offensive comments made by his girlfriend. Batten took over in February without a leadership contest, with a brief to stabilise the party.

He managed this, steering Ukip away from imminent bankruptcy and leading it to as high as 8% in the polls. However, internal critics said this was mainly down to the failing Brexit process, and urged Batten to end his focus on Islam and trying to get Robinson allowed into the party.