McGregor, who has been linked with Hearts, has left Hull City after collecting their player of the season award.
The 36-year-old is still at the peak of his game and becomes new manager Steven Gerrard’s second signing since taking over at Ibrox earlier this month. Out of contract Burnley midfielder Scott Arfield signed a four-year deal on Monday.
McGregor returns to Rangers six years after he left the club to join Turkish side Besiktas. He explained that the first moves to bring him back to Govan were made “two or three weeks” ago through John Brown, now a Rangers scout.
McGregor revealed he has yet to speak to Gerrard. “I think it is a coup to land Steven Gerrard. I saw his interview and hopefully he can bring us success,” he told Rangers TV. Although he won’t officially begin his managerial reign until 1 June, Gerrard spoke of his delight at capturing McGregor last night.
“I have played against Allan a number of times in my own career and I know just how fierce a competitor he can be,” said Gerrard on the club’s official website. “He is vastly experienced goalkeeper who we feel can add to the options available to us currently. He has won lots of silverware for this club, and has shone at the highest level in Europe.
“He is a Rangers supporter who rose through the ranks here, so having someone with such a depth of feeling towards the club is another great asset to the squad.”
McGregor’s return places doubt over current No 1 Wes Foderingham’s future. He has been linked with moves to Nottingham Forest and Sheffield Wednesday.
McGregor signed for then Premier League club Hull City in 2013 and, barring a spell on loan at Cardiff City, has been there ever since. Hull finished 18th in the Championship this season and while manager Nigel Adkins wanted McGregor to stay, the keeper rejected the new terms offered and became a free agent.
He described the lure of returning to Rangers, where he believes he has unfinished business, as too strong to resist. McGregor won three successive league titles with Rangers in 2009, 2010 and 2011. He lifted 11 trophies in total for the Ibrox club.
“I started training here when I was 12 years old and used to come through the main stand maybe twice a week,” said McGregor. “To be back is incredible.
“I can’t keep the smile off my face,” McGregor added. “When the chance came, it was an absolute no-brainer.”
“We need to make this place (Ibrox) a fortress, where nobody wants to come. We need to win games, no matter who you are playing. If you keep doing that, that’s what wins you titles.”
Edinburgh-born McGregor admitted he wondered whether he would ever get the chance to return to Rangers.
“When time goes by you think it might not happen and you have to enjoy your football elsewhere,” he said. “But once you know there is a wee sniff that it could happen then it was exciting. It came as a surprise. John Brown gave me a shout two or three weeks ago and I spoke to him a few times and now here I am.”