Ken Livingstone has resigned from the Labour Party, saying the allegations against him of anti-Semitism had become a “distraction”.

In statement, the former London mayor continued to reject the charge that he had been in any way guilty of anti-Semitism or had brought the party into disrepute.

However he acknowledged some of his comments had caused offence within the Jewish community for which he said he was “truly sorry”.

He said that he feared that if he had tried to carry on, the case against him could have dragged on for months, or even years to the detriment of the party.

Labour leader Jeremy Corbyn, one of his oldest political allies on the left, said he was “sad” to see him resign but it was the “right thing to do”.

However critics warned that the departure did not mean an end to the continuing political row over anti-Semitism within the Labour Party.

Backbencher Ruth Smeeth, one of the MPs leading the campaign for the Labour leadership to deal with the issue, tweeted simply “Good riddance Ken”.

Mr Livingstone was originally suspended in 2016 and after claiming in a radio interview that Hitler had supported Zionism in the 1930s.

Anti-Semitism campaigners had been demanding his permanent expulsion as a signal that the party was serious about dealing with the issue following a protest in March outside Parliament by members of the Jewish community.

As recently as this month, Mr Livingstone indicated he would resist any move to oust him, suggesting he would be prepared to take the case to courts if necessary.

In his statement, he said: “I do not accept the allegation that I have brought the Labour Party into disrepute, nor that I am in any way guilty of anti-Semitism.

“I abhor anti-Semitism, I have fought it all my life and will continue to do so.

“I also recognise that the way I made a historical argument has caused offence and upset in the Jewish community. I am truly sorry for that.

“I am loyal to the Labour party and to Jeremy Corbyn.

“However any further disciplinary action against me may drag on for months or even years, distracting attention from Jeremy’s policies.

“I am therefore, with great sadness, leaving the Labour Party.”

In response, Mr Corbyn said: “Ken Livingstone’s resignation is sad after such a long and vital contribution to London and progressive politics, but was the right thing to do.”

Ms Smeeth, however said that the party should have acted years ago to remove him following a series of alleged anti-Semitic incidents.

“Ken Livingstone’s behaviour has been grossly offensive to British Jews,” she said.

“His departure is welcome but the fact that he refuses to accept responsibility for his actions is a disgrace.

“The truth is that Ken’s despicable and hurtful attitude should have seen him expelled years ago and the fact that it has taken this long to see him go beggars belief”.

Backbencher Wes Streeting, another prominent Labour anti-Semitism campaigner, said : “We must now make it clear that he will never be welcome to return.

“His vocal cheerleaders and supporters should follow him out the door.”

In contrast, Chris Williamson, a left wing ally of Mr Corbyn, said the former mayor was a “towering figure” who had popularised “progressive socialism” while opposing all forms of racism.

Conservative Party deputy chairman James Cleverly said: “If Jeremy Corbyn and the Labour Party were serious about tackling anti-Semitic racism within the party they would have kicked out Livingstone two years ago.

“All Jeremy Corbyn could muster was that it was sad that Ken had chosen to go.”

Mr Livingstone said he had acted after being tipped off at the weekend that right-wingers on the party’s ruling national executive committee had been planning to raise his case again when it meets on Tuesday.

“I just didn’t see any point in this rumbling on and on,” he told the BBC.

“If I was still seeking office I’d have to fight to stay in but I can support Jeremy and all the other things I believe in from outside the Labour Party.”

Mr Livingstone, 72, refused to rule out the possibility he could seek to rejoin the party at some point in the future.

“It depends on how long I live, doesn’t it? We will come back and talk about it in a couple of years,” he told Sky News.