Manchester United goalkeeper David de Gea, who came within minutes of joining Real Madrid last week, signed a new four-year contract with the English Premier League club on Friday.
The announcement caps a remarkable turn of events after the Spain international was on the verge of signing for the Spanish giants only for the transfer to collapse because of paperwork arriving past the permitted deadline.
United announced on their official Twitter account: "David de Gea has signed a new four-year contract at #mufc with an option to extend for a further year."
De Gea, 24, said: "I am delighted to be starting this new chapter in my United career.
"I have always enjoyed playing with these great players in front of our fantastic fans. Manchester United is a special club and Old Trafford is an ideal place for me to continue to develop my career.
"I'm looking forward to putting a difficult summer behind me and concentrating on working hard to improve and help my team-mates to be successful."
The news of an extension was understandably well received by United manager Louis van Gaal, who said: "I am absolutely delighted David has signed a new contract.
"He is one of the best goalkeepers in world football. I am very pleased that he will be part of the team for many years to come.
"David made a very important contribution to our performance last season and he has been the club's Player of the Year for the last two seasons.
"He is a popular player who is keen to learn and enhance his game. At such a young age for a goalkeeper, he has many years ahead of him," added Van Gaal.
That De Gea has committed his future to the Premier League giants is all the more remarkable given the events of the past few months.
The Spaniard, long courted by Real, was on the brink of a move to Madrid worth between 30 and 40 million euros and involving Costa Rica goalkeeper Keylor Navas in part-exchange.
But the deal collapsed at the last minute, with a Spanish Professional League (LFP) spokesperson telling AFP that De Gea had not been registered as a Madrid player.
The Spanish club subsequently released a statement accusing United of sending the necessary documents after the deadline had passed in Spain.
In a statement of their own, United laid the blame at Madrid's door, adding: "The club is delighted that its fan-favourite double Player of the Year, David de Gea, remains a Manchester United player."
De Gea hasn't played for the Premier League club this season after being dropped by van Gaal, who claimed the player had told him he wasn't in the right frame of mind to play while the transfer saga dragged on.
But with his future now cleared up De Gea could be set to return to the United team in time for Saturday's showdown at home to fierce rivals Liverpool.