The clubs came to an agreement over the weekend and the Red Dragons boss will move to the League One club after half a season.
It’s deva vu for Wrexham fans after Dean Keates left for Walsall back in March.
They must now rebuild with the club in title contention in the National League and in the hat for Monday’s FA Cup third round draw.
“Following an approach from Shrewsbury Town we did everything possible to retain his services, however, once this interest became known, Sam expressed his desire to speak to them regarding their vacancy,” said a club statement.
“Shrewsbury Town triggered elements in Sam’s contract enabling them to approach him and at that point we were obliged to allow him to speak to them.
“Following his discussions with Shrewsbury Town, Sam informed us of his intention to take up their vacant manager’s position on Saturday morning and in the best interests of Wrexham AFC, we asked him not to attend our FA Cup second round fixture versus Newport County on Saturday night.
“Wrexham AFC are in a strong position after 22 league games of the 2018-19 season. We would like to thank Sam for his efforts and for the work he did while at the football club.
“We are fully focused on further improving upon this situation going forward. Wrexham AFC have already begun the process to appoint Sam’s successor with Graham Barrow taking charge of the first team on an interim basis.
“We will make further announcements regarding this matter as soon as possible.”