Hearts have confirmed the appointment of John McGlynn as their new manager.

The 50-year-old leaves his position at Raith Rovers to take up the post at Tynecastle, where he was previously employed as a coach for 10 years.

McGlynn replaces Paulo Sergio in the Gorgie hot-seat, after failure to agree a new deal with the Edinburgh club sealed the Portuguese's departure earlier this month.

A Hearts spokesperson confirmed: "We are delighted to announce the arrival of John McGlynn as manager of Heart of Midlothian FC."

McGlynn first joined Hearts in 1996 and had two spells as caretaker manager in 2005, before acting as assistant boss to Valdas Ivanauskas the following year when the Jambos won the Scottish Cup.

He quit Hearts in November 2006 to take over as manager at Raith and guided the Kirkcaldy club to the Second Division title in 2009.

McGlynn then steered the Fifers to their first Scottish Cup semi-final appearance for nearly 50 years in 2010 and was also voted the PFA Scotland manager of the year in season 2010-11.

A Hearts spokesperson added: "Understandably the post attracted interest from around the globe and the quality of the applications made it a difficult decision.

"John's track record, though, in developing young players is outstanding and one of the key criteria for the appointment was an ability to successfully integrate youngsters into a senior squad which can compete competitively at the top end of the table.

"He also knows the club intimately having previously spent 10 years as a coach here and we are confident he can take the club forward and build on the success of last season's William Hill Scottish Cup triumph.

"We would also like to put on record our appreciation of Raith Rovers' co-operation in this matter and wish them all the best for the forthcoming season."

Sergio left Hearts when talks broke down over a new deal within weeks of leading the Edinburgh club to success in the William Hill Scottish Cup with an emphatic 5-1 win over city rivals Hibernian in the final.

He had taken up the reins at Gorgie last August before becoming the ninth man to leave the post under majority shareholder Vladimir Romanov.

The club previously confirmed first-team coach Gary Locke would remain following Sergio's departure and would be part of the new coaching set-up.

McGlynn admitted leaving Raith will be a wrench but believes now is the right time for a new challenge at a club which already means a lot to him.

He told HeartsTV: "I'm looking forward to it and I'm delighted to be back. I've had five and a half good years at Raith Rovers and I'm looking forward to the challenge.

"I've got to go back to Raith Rovers tonight and say goodbye to the players and that's going to be difficult because there are some great characters there and some great players at that particular level.

"I built up some great relationships with the board of directors, the players, my backroom staff and all the fans. Everyone has been so good to me to be honest so it is a wrench to leave Raith Rovers.

"It's been good there and I've had some good times but it's time for a move. I'm ambitious and I'm delighted to get back to the SPL with a club that's at my heart.

"I was 10 years here previously. I know the players and I know the younger players coming through, having worked with some of them at Raith Rovers.

"I'm looking forward to working with the players."