Dean Keates has left Wrexham and taken over as manager of hometown club Walsall.

Keates has signed a three-and-a-half year deal at the League One club, replacing Jon Whitney who was sacked on Monday after two years in charge following a run of four defeats in the last five games which leaves the 15th placed Saddlers six points above the relegation zone.

A compensation package has been paid to Wrexham, where Keates was under contract until the summer of 2020.

Andy Davies, assistant to Keates at The Racecourse, and first team coach Carl Darlington are the interim management team and will take charge of promotion-chasing Wrexham at Woking tomorrow, while the club hope to appoint a new manager "as quickly as possible."

A club statement read: "Wrexham AFC can confirm that First Team Manager Dean Keates has left the club to join his hometown team Walsall FC.

"We want to place on record our appreciation to Dean for his time here as a player, captain and as First Team Manager.

"Walsall FC approached us and triggered the release clause in Dean’s contract in full, therefore we were obliged to allow Dean the opportunity to speak to the club that he supports.

"We are in a strong position and our focus remains on achieving promotion to the Football League this season.

"There are just nine games of the season to go and now more than ever, we need the support of each and every fan of Wrexham AFC to rally around our interim management team of Andy Davies and Carl Darlington, the remainder of the staff and the playing squad.

"We are fully focused on achieving three points at Woking on Saturday.

"While we have already begun the search to replace Dean and complete our management team and intend to make an appointment as quickly as possible."

Keates was immediately installed as one of the favourites with bookmakers to succeed Whitney when he was sacked.

The 39-year-old Keates began his career at Walsall where he won promotion three times during two successful spells, but he told the Leader on Tuesday that he was happy at Wrexham and under contract until the summer of 2010.

However, Walsall then made an approach and after holding talks with the club, has now been unveiled as their new manager.

Keates is building a reputation as a promising young manager after turning Wrexham into promotion contenders.

After taking charge in October 2016 following the dismissal of Gary Mills, Keates signed a new three-and-a-half year contract last February and guided Wrexham to a mid-table finish last term.

Having revamped the squad over the summer, Keates has revived Wrexham's fortunes this season.

Sunday's 2-0 cross border derby victory against Chester extended the unbeaten run to 13 games and leaves Wrexham fourth in the National League, eight points behind leaders Macclesfield Town, with nine matches remaining.

It brings the curtain down on Keates' spell at Wrexham where he spent five seasons as a player, captaining the Reds to FA Trophy success at Wembley in 2013 and reaching the play-offs three times.

Keates said he couldn't turn down the chance to return to Walsall.

“I’m delighted to come back,” Keates told Saddlers TV.

“I finished my career and learned my trade, coaching at a university linked to Wrexham and then had the opportunity for the last 14 months to be a manager there.

“I’m from the area. I was on the terraces at Fellows Park and then at the Banks’s – I’m a fan of the club and it feels good to be back.

“I’m still learning my trade but everyone is learning their trade, no matter their age.

“This opportunity came up for me and it wasn’t something I could let pass by. It’s my hometown and that’s a big thing for me.”