Ian Blackford is to stand down as the SNP's leader at Westminster. 

In a statement, the Ross, Skye and Lochaber MP he would not be standing for the leader's job at the parliamentary party's AGM next week, and that had accepted a new position "at the centre of the SNP’s independence campaign, leading on business engagement."

Just last week, Mr Blackford boasted to The Scotsman that he would be the "MP which leads the SNP group out of Westminster for the last time." 

The shock decision follows on from a botched leadership challenge by Aberdeen South MP Stephen Flynn and rumours of unhappiness from his backbenchers over his performance in the chamber and his handling of the Patrick Grady affair.

In his statement, Mr Blackford said: "After more than five years in the role, now is the right time for fresh leadership at Westminster as we head towards a general election and the next steps in winning Scotland’s independence.

"During my time as leader, the SNP won a landslide victory in the 2019 general election, with an increased share of the vote and MPs, and support for independence has continued to grow with polling this week showing a majority in favour.

"While I am stepping down as Westminster leader, I will continue in my role as the MP for Ross, Skye and Lochaber, and I have also accepted a new role at the centre of the SNP’s independence campaign, leading on business engagement.

"I would like to thank our MPs and staff for all their support over the past five years. Whoever replaces me as Westminster leader will have my full support as, together, we stand up for Scotland's interests and democratic right to choose our future in an independence referendum."

The parliamentary party's AGM takes place on Tuesday, which could mean a new leader facing Rishi Sunak at Prime Minister's Questions next Wednesday.

Last month, Mr Flynn, the SNP’s energy spokesperson, was understood to have told senior party officials he wanted to lead the group at Westminster.

According to the Times, his supporters believed he had the backing of enough MPs to try ousting Mr Blackford.

However, he later took to Twitter to say he has “no intention of standing”.

Mr Blackford had been criticised for his handling of the allegations surrounding Patrick Grady.

A 19-year-old SNP staff member was subjected to unwanted sexual advances from the Glasgow North MP in 2016. 

Despite the party being aware of the complaint, Mr Grady was allowed to remain in post as the SNP's Chief Whip until March 2021 - when The Herald first revealed the accusations against him.

There were calls for Mr Blackford to resign over the summer after a recording of a meeting of the parliamentary group was leaked to press, in which he could be heard urging colleagues to give Mr Grady "as much support as possible". 

He also found himself undermined by Nicola Sturgeon after she rubbished his claim that the UK Government would continue to pay pensions to Scots after independence. 

Joanna Cherry said she was "pleased" to hear of Mr Blackford's decision. 

The Edinburgh South West MP was sacked by Mr Blackford in February last year.

She tweeted: "I’m pleased to hear this. It’s time for fresh leadership & tolerance of debate & diverse viewpoints.

"I hope @theSNP Westminster group will be now be left to choose our new leader without outside interference & in accordance with our standing orders."

Ms Sturgeon said Mr Blackford had "done an outstanding job in holding the Tory government to account and in promoting the case for independence."

She added: “I would like to place on record my thanks for Ian’s diligence, tenacity, friendship and loyalty in his time as group leader.

"He will continue to play an important role as constituency MP for Ross, Skye and Lochaber, and I have also asked him to take on a role as part of the wider SNP team preparing the case for independence.

“I look forward to working with Ian’s successor as group leader at Westminster, as we continue to make the case for the people of Scotland to have a democratic choice on the country’s future.”

Labour's shadow Scottish secretary Ian Murray said the resignation was a sign that the SNP were in "total disarray."

"The nats are deserting the sinking ship," he said.

“Nationalist MPs know Nicola Sturgeon’s plan for a de facto referendum is finished before it's even started and are worried about Labour gaining seats."

Lib Dem MP Christine Jardine said Mr Blackford "should have stepped aside a long time ago."

"From his bitter campaign against Charles Kennedy to his mishandling of sexual harassment allegations against an SNP MP, it's clear that Ian Blackford has never been fit to lead," she said.

Scottish Conservative Chairman Craig Hoy said Mr Blackford had "jumped before he was pushed."

He added: His resignation is a total humiliation for Nicola Sturgeon. She shamefully stood by her Westminster leader earlier this year despite his appalling handling of the complaints made against Patrick Grady.

“This showed a total lack of judgement by Nicola Sturgeon. Ian Blackford should have been sacked immediately for his disgraceful behaviour but he was allowed to stay in post for several months and now gets to dictate the terms on which he leaves."