LONDON (Reuters) - Former Scottish first minister Alex Salmond said on Wednesday he has resigned from the Scottish National Party, which he led for two decades, days after allegations of sexual misconduct became publicly known.

FILE PHOTO: Former First Minister of Scotland Alex Salmond talks about his show 'Alex Salmond Unleashed' at the Edinburgh Fringe, Edinburgh, Scotland, Britain August 12, 2017. REUTERS/Russell Cheyne

Salmond has denied the allegations and taken legal action against the SNP administration he once ran over the way it has handled the complaints against him.

The driving force behind Scotland’s 2014 independence referendum and still a popular figure in Scotland, Salmond said he was taking the action to protect the SNP from its opponents and avoid any internal division were he to have been suspended from the party.

“I did not come into politics to facilitate opposition attacks on the SNP and, with parliament returning next week, I have tendered my resignation to remove this line of opposition attack,” Salmond said in a statement.

Salmond said he would reapply to the party if he wins his court action. At the same time he launched a crowd-funding appeal to raise 50,000 pounds ($65,000) to help pay his legal costs against the Scottish government over its handling of the misconduct complaints against him.

The Scottish government said last week two allegations of misconduct against Salmond were filed in January of this year. Salmond said he rejects any suggestion of criminality.

Salmond, who headed the devolved Scottish government for seven years until 2014, is credited with helping to push support for Scottish independence from the United Kingdom to record levels during the referendum campaign.

Scots, however, voted 55-45 percent in favor of staying in the UK.

Nicola Sturgeon, his successor as party leader and first minister, has come under pressure from opposition parties to suspend his membership while the claims are investigated.

Sturgeon said she felt “a huge sadness about this whole situation” but understood why he decided to resign.

She said that Scotland’s battle for independence is “bigger than any one individual.”

Salmond’s relationship with his own party has been more strained since he lost his seat in the Westminster parliament last year.

“I am conscious that if the party felt forced into suspending me it would cause substantial internal division,” Salmond said. He intended to reapply for party membership “just as soon as I have had the opportunity to clear my name”, which he hoped would be by the end of the year.

“For my part I have always thought it a very poor idea to suspend any party member on the basis of complaints and allegations,” Salmond said. “Innocent until proven guilty is central to our concept of justice.”