Rangers defender David Bates will join Hamburg this summer after agreeing a four-year deal with the German club.
The 21-year old has signed a pre-contract and will leave Ibrox when his contract expires at the end of the season.
Bates, who has not played since injuring an ankle against Celtic last month, initially joined Rangers on a loan deal from Raith Rovers in 2016 before making the move permanent.
He became a regular under Graeme Murty and has made 17 appearances this season.
His new club Hamburg are in danger of being relegated from the Bundesliga. They are second from bottom and five points behind Mainz in 16th place.
Writing on his Twitter account, Bates said the opportunity to move to Germany was a chance he could not pass up.
"After a whirlwind 48 hours, I am absolutely delighted to have my future sorted," Bates said. "Like Rangers, HSV are (an) iconic club with tremendous history and all the pressures that come with that.
"They have given me a lot of faith in their recruitment and I can't wait to kick on & develop further as a player. It was an opportunity I don't think anyone could turn down.
"I'd like to thank all the fans, staff and board for the last two years. Hopefully I can get back fit enough to help in some way to finish as high as possible."
The German club issued a statement on its website saying: "HSV is continuing its personnel planning for the future and shaping the new team squad.
"For the upcoming season, the club can announce their first signing, David Bates, centre-back of Glasgow Rangers.
"Bates, who has been on duty for Rangers in the Europa League, is now transferring to the Elbe on a free transfer and wants to continue his positive development here."
Hamburg scouting director Johannes Spors added: "David brings in the combination of height, speed, mentality and accountability features for the defence that will be good for sure.
"He is a down-to-earth guy who wants to actively develop his career and work hard for it."
Bates is facing a minimum of six weeks on the sidelines after being stretchered off against Celtic which means he is set to miss Sunday's Scottish Cup semi-final with the Hoops, live on Sky Sports.