"He has done an excellent job for us and the Scottish national team. We are very disappointed that he has chosen to leave us at this critical time in our Euro 2008 qualification campaign."

An SFA statement said: "At a meeting this morning with the chief executive of the Scottish FA, Walter Smith delivered a letter of resignation with immediate effect from his position as national coach of the Scotland team.

Smith welcomes his new staff to Rangers

"No agreement has been reached with Mr Smith or Rangers Football Club on any compensation payment to be made for the early termination of his employment, which is in breach of his contract with the Scottish FA."

Smith said: "I am delighted to return to Rangers as manager. This club has always been in my blood and I can't wait to get started.

McCoist was overjoyed at returning to the club, saying: "It was a privilege to pull on the Rangers jersey for so many years but I am delighted to return as assistant manager.

"I was honoured to be named in the greatest ever Rangers team and included in the club's Hall of Fame, but this is something really special. I know the club inside out and I am ready for the challenge."

This will be Smith's second spell at Ibrox, after helping Rangers win nine successive titles before resigning in 1998 and moving to Everton.

Both Smith and Rangers legend McCoist have played a pivotal role in Scotland's stunning start to their Euro 2008 qualifying campaign.

Scotland are the surprise Group B leaders in the Euro 2008 qualifying phase, ahead of world champions Italy and World Cup runners-up France.

Smith had offered to work in a dual role with Scotland and Rangers until the end of the season but the SFA would not entertain the suggestion.