Martin O'Neill has resigned as manager of Aston Villa just five days before the start of the Premier League season.
There had been speculation over his future at Villa Park with the impending sale of James Milner and interest in Ashley Young from Premier League rivals.
O'Neill was close to leaving Villa at the end of last season but opted to stay after talks with owner Randy Lerner.
"Aston Villa can confirm that Martin O'Neill has resigned as manager of the football club with immediate effect,'' the club said in a statement.
"Kevin MacDonald, reserve team manager, has assumed the role of caretaker manager and will prepare the team for the opening Premier League game of the season against West Ham on Saturday at Villa Park.''
Martin O'Neill added: "I have enjoyed my time at Aston Villa immensely. It's obviously a wrench to be leaving such a magnificent club.
"I would like to pay tribute to the Villa players, my coaching staff and the Villa supporters for all the support and encouragement they have given both the club and me personally during my time as manager.
"I wish them all the best for the future. I will obviously be assisting the club in the immediate short-term with regard to the handover of my duties."
O'Neill took charge of Villa almost four years to the day, replacing Irishman David O'Leary at the helm. Afterguiding the club to 11th in his first season in charge, Villa then finished sixth in each of the following three seasons.
He also led the club to the Carling Cup final last term, where they lost 2-1 to Manchester United, and also the FA Cup semi-finals - only for Chelsea to oust them at Wembley.
But O'Neil's tenure at Villa Park was tainted by poor performances in the second half of the season, which cost them the chance of Champions League football.
O'Neill, who enjoyed successful spells in charge of Leicester City and Celtic before moving to the Midlands, is thought to have grown frustrated with a lack of funds to push the club on to the next level.
That was not helped by the sale of Gareth Barry to Manchester City last summer, and with James Milner almost certain to walk the same path, speculation is rife that a frustration at not being able to strengthen is to blame for O'Neill's departure.
Paul Faulkner, chief executive of Aston Villa, said: "The club would like to thank Martin for the great work he has done at Aston Villa over the past four years.
"He has helped to establish the club in the upper echelons of the Premier League, has taken us to Wembley and we have also qualified for European competition for the past three seasons under his management. We wish him the best in the future."
The League Managers' Association released a statement from chief executive Richard Bevan which read: "The LMA shares Martin's disappointment at him leaving Aston Villa. He has achieved great success not just with Villa but throughout his managerial career.
"He is a great example to all aspiring managers having built the foundations in non-league football to then go on to successfully manage at the highest level in the game."
Jonathan Fear, editor of the Villa fans' website Vital Villa, said: "I'm not altogether surprised that Martin has left but I am shocked at the timing. The timing will make it really difficult for the board to get the type of manager we need quickly.
"I thought it had run its course and maybe the end of last season was the time to go. Maybe this could be a good thing for both parties because frustration seemed to be growing.
"But the timing does seem crazy just before the start of the season. I believe the board have got to go for a 'name' to show the ambition is still there.''