Former SNP leader Alex Salmond has resigned from the party he headed for 20 years amid allegations of sexual harassment.
Mr Salmond, who strongly denies the claims against him, said he was giving up his membership to avoid potential divisions within the party.
The former first minister of Scotland also announced a crowd-funding campaign to help with his costs in a legal action against the Scottish Government.
Opposition parties have attacked the fundraising move as "astonishing" and "unbelieveable".
Nicola Sturgeon, the current First Minister and SNP leader, voiced her "huge sadness" in the wake of his decision but said she understood why her mentor for three decades had chosen to relinquish his party membership.
Mr Salmond made the revelation in a video message posted online on Wednesday evening.
He stated: "I have been a member of the Scottish National Party for 45 years, 20 of them as party leader and seven as first minister of Scotland.
"I hope I have done the party and the broader cause of independence some service...
"I truly love the SNP and the wider independence movement in Scotland. They have been the defining commitment of my life.
"But today I have written to the national secretary of the party resigning my membership."
Two complaints, fiercely denied by Mr Salmond, were raised in January against him and he was informed of an investigation in March.
Mr Salmond is taking court action against the Scottish Government to contest the complaints process activated against him, with papers lodged at the Court of Session in Edinburgh on Tuesday.
Ms Sturgeon had faced calls from opposition parties to suspend Mr Salmond from the SNP after the allegations emerged, but she insisted there was "no legal basis" to do so.
However, in his latest statement, Mr Salmond indicated he wanted to avoid a potential internal split within the SNP.