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 fra-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.”

The MEP said he wondered whether he was giving his last UKIP speech when addressing the party’s annual conference this year.

He writes: “My message was very simple: one of the reasons for UKIP’s success was that we’d excluded extremists and focused on organising and fighting elections. I warned that any change to this policy would damage the party beyond repair.

“As I walked back to my seat, I was met by several angry young men, red in the face and mildly abusive, who all seemed to be obsessed with Islam and Tommy Robinson.”

He suggested the party is not able to become the “Brexit party our nation so badly needs”.