Manchester City were denied in their bid to sign Gago from Real Madrid. Photograph: Stephen Pond/Empics

Manchester City failed in last-minute efforts to sign the Real Madrid midfielder Fernando Gago in a deal worth a potential €18m (£15.7m). Gago, who had asked Madrid to allow him to leave, spent much of today in a hotel awaiting developments but was forced to stay at the Santiago Bernabéu after the clubs failed at the 11th hour to reach agreement on the terms of the transfer.

City were keen to bring the Argentina international to Eastlands and Madrid were willing sellers but, with time running out to finalise the details and complete paperwork on a permanent move, City proposed a loan with an option to buy for €18m only for Madrid to refuse.

Completion of the move was hindered by the fact the Premier League deadline was 5pm UK time – six hours before La Liga's cutoff point. Sources close to negotiations in Madrid suggest that Madrid were seeking to profit from brinkmanship believing they had longer than they realised, only for time to run out on the deal. They also claimed that further delay was caused by the need of those negotiating on City's behalf to get a formal go-ahead from the owner, Sheikh Mansour.

When City first made inquiries about Gago last month, they were quoted €25m and decided not to pursue the transfer further. City's valuation was €15m. But with Gago pushing to be allowed to leave and Madrid keen to bring in a fee, the Spanish club contacted City yesterday to offer Gago for €18m. City considered it too late to close such a deal but their offer of a loan was rejected.

Gago joined Real Madrid for €18m from Boca Juniors in November 2006 but he has played just five league games so far this season. City's manager, Roberto Mancini, will be disappointed a deal for the 23-year-old was not completed, having targeted another defensive midfielder to follow his signing of Patrick Vieira. Mancini also saw a move for the Kenya midfielder McDonald Mariga collapse today when the 22-year-old was not granted a work permit. Mariga instead left Parma for Internazionale.

City did succeed in buying the winger Adam Johnson from Middlesbrough for about £7m. "He is a very good player with fantastic potential and as a club we are always keen to sign British talent," Mancini said. Johnson said he felt it was time to leave his "comfort zone" at Boro.