North East MEP Jonathan Arnott has said he will resign in protest over UKIP's election campaign and its "demonisation" of Muslims.
The party's general secretary and constitutional affairs spokesman said he will be stepping down from those posts.
As he did so, he also praised the job done by his close friend and party leader Paul Nuttall, who today stood down as its leader following the party's failure to win any seats in the general election.
Mr Arnott, who is based in Hartlepool, said: "Paul has been badly let down by many people, including some of his most senior advisers."
He said the party had "lost its way" and said the manifesto had been shown to the NEC "at the very last minute".
Party officials had "barely an hour" to approve a document which he described as not "good enough" and offered "very little" for families.
He said UKIP should be tough on terrorism.
"But as a party we have fundamentally failed to make the distinction between the vast majority of peace-loving Muslims, honest and good people, including those I am proud to call my friends, and the unutterable evil of the perversions of Isis," he said.
"Tough and robust policies to tackle extremism are absolutely right.
"The victimisation or demonisation of Muslims and Islam is not."
Mr Arnott said he did not support a burka ban and proposing "genital inspections of schoolgirls was crass and ill-conceived at best".
In a statement on his website he states: "I do not personally support a complete burkha ban (it’s different in situations where there’s a security risk, just like I don’t like football hooligans wearing balaclavas outside a stadium to avoid being filmed by police).
"The policy of genital inspections of schoolgirls was crass and ill-conceived at best.
"FGM is an issue which is fundamentally about child sexual abuse, but UKIP’s clumsy blundering approach detracted from an important issue of child protection.
"Despite FGM being a cultural practice, UKIP allowed it to be seen and misrepresented as relating to Muslims specifically.
"Instead of talking about vital issues, of keeping our children safe, UKIP found itself defending accusations of bigotry.
"When I was General Secretary before, the party was ruthless in kicking out those who expressed vile racist views.
"Whatever the media said, we did not tolerate it and those people rightly were shown the exit door.
"The role of General Secretary does not come with executive power, and I have been powerless to do anything about the most extreme of comments.
"I don’t agree with hardline anti-Islam messages.
"Yet in the wake of the London and Manchester attacks, it was a ‘perfect storm’ for those who espoused such views.
"If it was ever going to win votes at the ballot box, it was on Thursday.
"It failed. It did not work and it can not work.
"I’ve expressed my views in private to the party leadership and others over many months, to no avail.
"I must now say something in public. I will try to avoid naming individuals, but promote positive alternatives and policies for the party."
The full statement can be read here.
He added he has agreed with his party his resignation will not take affect until after an emergency NEC meeting on Monday.