Real Sociedad have reached an agreement to buy goalkeeper Geronimo Rulli from Manchester City, the La Liga club have announced.

Argentina international Rulli, currently appearing for his country at the Olympic football tournament in Brazil, has played for Sociedad on loan from Uruguayan feeder club SD Maldonado for the last two seasons.

Earlier this summer, Premier League giants City were reported to be in talks to sign the highly rated shot stopper with the third party investment group that owns his “playing rights” while at Maldonado.

Rulli himself admitted he was aware of City’s interest, while not commenting on reports that he had spoken with the Premier League club’s new coach Pep Guardiola about the future.

Reports in England then said the 24 year old had signed for City, with his previous owners receiving million, but the player would spend 2016 17 on loan back at Real Sociedad.

La Real have now released a statement saying they have agreed a deal to buy him outright, with the transfer for an undisclosed fee to be completed in the January 2017 window.

“Real Sociedad have reached an agreement with Manchester City for the signing of Gero Rulli by the Txuri urdin club,” the statement said. “The Argentine goalkeeper will be on loan until December and then the blue and whites will sign him permanently until June 30, 2022.

“The agreement was finalised when the English FA received the official transfer from the Uruguayan federation, after the agreement between Manchester City and SD Maldonado. Once this procedure was finished, it was possible to sign the contracts between Real Sociedad and Manchester City.”

Rulli told the club website that he is delighted to be staying at the San Sebastian based side.

“From the first day La Real have treated me very well,” he said. “They opened the door for me in Europe, trusted in me. I have found my best form here and improved as a person. I am now in one of my best moments, staying at La Real, and being called up for the national team for the Olympic Games. I want to thank my family, friends, girlfriend, teammates, and the people who work for the club. They are all part of what his happening. I have no doubt we can have a good season.”

Sociedad president Jokin Aperribay admitted that a lot of work had gone into getting Rulli on a permanent deal.

“This is something we have been working on for a long time,” Aperribay said. “[Rulli] really wanted to stay with La Real and La Real really wanted him to stay. This is a great day.”