Townsend will take the reins from Vern Cotter next June, with the New Zealander’s Scotland contract expiring at the end of May 2017.
It is understood that discussions on a succession plan have been going on over the past few months.
The SRU statement announcing the news acknowledged that Townsend, who led Glasgow to Scottish rugby’s first major club trophy of the professional era when they won the Guinness Pro12 in 2015, was in demand around the world and the governing body wanted to establish him as the man to take Scotland towards the 2019 World Cup in Japan.
Townsend was always the obvious native candidate to replace Cotter if he decided not to stay beyond the end of his contract, which was extended by a year ahead of the 2015 World Cup. However, there was a feeling that the 43-year-old, who enjoyed a widely travelled playing career, may want to test himself with a major foreign club before later making the transition back to the international game.
In the end, the lure of the Scotland job has proved too strong to resist for the 82-times capped former stand-off and he will become the first Scot in the role since Frank Hadden stepped down seven years ago.
Townsend, who had a spell as assistant coach with Scotland from 2009-2012, said: “I am incredibly proud to take on the Scotland head coach role at the end of the season.
“It is a real honour to be given the responsibility of coaching the national team and I look forward to working with such an impressive group of players.”
Scottish Rugby chief executive Mark Dodson said: “Gregor’s abilities as a head coach are evident and he is increasingly becoming one of the most sought-after coaches in the game.
“I have been charged with developing Scottish coaches and believe the time is now right to secure Gregor’s talents, as we build towards the 2019 Rugby World Cup in Japan
“Vern Cotter has made a considerable impact on the development of the Scotland national side during his tenure. His rugby philosophy of setting high standards with a big emphasis on skill development has had a positive effect throughout Scottish rugby.
“He has helped instil self-belief, determination and put a lot of pride into the jersey for players and fans alike and for this, both myself and Scottish Rugby would like to thank him for this significant contribution to the game in Scotland.
“We will continue to work with Vern in the season ahead as we are both determined to have a successful autumn Test series and 2017 RBS Six Nations.
“However the Board and I now believe the time is right to take the development of the national team forward with Gregor.”
The SRU had all three of their premier coaches in place until the end of next season and will now likely have new men in all three posts come next summer. The SRU said a recruitment process is now under way to replace Townsend at Glasgow Warriors, while it is unlikely that 66-year-old South African Alan Solomons will stay on beyond his current contract.
If Cotter, who has been Scotland coach since the summer of 2014, was to extend his contract beyond 2017 it would have to be through the next World Cup which would be a big commitment for a man who may well have ambitions to return to France, or perhaps even his native New Zealand.
The man who led Scotland to within a whisker of the World Cup semi-finals last autumn now has a year to assess his future options. He said: “I intend to remain focused on the upcoming Autumn Internationals and remaining Scotland matches in 2017.”