Keegan's departure will be a massive blow to Newcastle fans
Kevin Keegan has resigned as manager of Newcastle United after just eight months in charge.
The announcement follows lengthy talks between the 57-year-old and the board.
"I've been working desperately hard to find a way forward with the directors, but sadly that has not proved possible," Keegan said in a statement.
"It's my opinion that a manager must have the right to manage and that clubs should not impose upon any manager any player that he does not want."
Keegan's resignation comes after three days of intense speculation about his future.
About 200 angry fans gathered outside the club's St James' Park ground on Thursday night after hearing of his departure, and some were even seen scaling the walls attempting to get into the ground.
They chanted Keegan's name and called for club owner Mike Ashley and executive director Dennis Wise to quit.
Report: Keegan resigns as Magpies boss
A Newcastle statement said the club was "sad and disappointed" that he had resigned.
It added: "Over the last few days, the club has devoted itself to the discussions it has held with Kevin and as a result of those discussions had put together a set of practical suggestions for how to move forward.
"The club made it clear to Kevin that if he had any outstanding concerns on its proposals, he should raise them with the club.
"The club regrets that Kevin has, instead of taking up that offer, chosen to resign."
Keegan made clear his feelings about Newcastle's summer transfer activity at a meeting with the board on Monday, the day the transfer window closed.
I have been left with no choice other than to leave
Keegan was furious to discover members of his already slim squad had been offered for sale during the final hours before the window closed, after he had reluctantly accepted James Milner's £12m departure to Aston Villa.
Having assured the club's fans he expected to recruit three or four top-quality signings by the time the deadline passed, he was left with only Spanish striker Xisco and loan signing Ignacio Gonzalez.
Following those talks, he was again summoned by the hierarchy on Tuesday - and at one stage it was widely understood and reported that he had parted company with the club.
Fans devastated after Keegan's departure
Amid protests by fans, the club was forced to deny it had sacked him, while the League Managers' Association insisted he had not resigned and that talks would continue.
However, in a statement released by the LMA late on Thursday, Keegan duly announced his departure from the club for a second time.
He added: "It remains my fervent wish to see Newcastle United do well in the future and I feel incredibly sorry for the players, staff and most importantly the supporters.
"I have been left with no choice other than to leave."
The LMA statement read: "The letter which Kevin received today from managing director Derek Llambias has failed to resolve the matters in issue between him and the club and accordingly he feels he has no alternative other than to resign."
Keegan's departure comes in a tumultuous week for English football.
On Monday, Manchester City - backed by prospective new owners the Abu Dhabi United Group - broke the British transfer record to complete the £32.5m signing of Robinho from Real Madrid from under Chelsea's noses.
And on Wednesday, Alan Curbishley beat Keegan to become the season's first Premier League managerial casualty when he resigned from West Ham only three games in.
A lack of control over transfer policy was also behind Curbishley's decision.
Keegan returned for a second spell as Newcastle manager in January, to the delight of an adoring faithful on Tyneside.
He led the Magpies to safety last season and the club had made a solid start to this season - but Keegan had become increasingly unhappy with the club's management structure.
Shortly after appointing Keegan, Ashley brought in Wise as a "football-related" executive director while Tony Jimenez was appointed vice-president of player recruitment.
"This is a club in disarray, turmoil, and twas ever thus it seems," commented BBC Radio 5 Live football correspondent Jonathan Legard.
Newcastle have employed seven managers since Keegan's first spell ended in 1997.
Fans protest outside St James' Park on Thursday night
Kenny Dalglish, Ruud Gullit, Sir Bobby Robson, Graeme Souness, Glenn Roeder and Sam Allardyce all came and went before Keegan's return.
At what turned out to be Keegan's last game in charge at Arsenal on Saturday, Ashley stood with the fans wearing a Newcastle shirt with 'King Kev' on the back.
But many supporters are now directing their anger at the chairman following the departure of a man who has been idolised on Tyneside since he led them to promotion to the top flight as a player in 1982.
Keegan took over as manager for the first time in 1992, once again leading them back to the top flight before narrowly missing out on the title in the 1995-96 season.
Less than two years later, Keegan stunned the sport by resigning, saying he had taken the club as far as he could.
Ashley's under-estimated fans - Magpies fanzine editor Steve Wraith
His return in January this year was hailed by the Newcastle fans as the "return of the Messiah", but just eight months later, he handed in his resignation for a second time.
Before his second spell with Newcastle, Keegan had been running his "Soccer Circus" football academy in Glasgow, after he stepped down as a manager at Manchester City in March 2005.
He left the England job suddenly after losing to Germany in October 2000, having managed Fulham prior to running the international team.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.