Dwane Casey has agreed to terms to be the Pistons' next head coach, ESPN reported.

The contract, which is a five-year deal, will bring Casey to Detroit after the Pistons fired Stan Van Gundy this past season.

Casey himself was fired from the Raptors after the Cavaliers swept them in the Eastern Conference playoffs after seven seasons in Toronto. It was the first time the Raptors held the top seed in the playoffs.

The team finished with a 59-23 record, which gave Casey a 320-238 record and made him the franchise's winningest coach.

Casey also coached the Timberwolves from 2005-07, where he amassed a 53-69 record.

Other candidates up for the Pistons' head coaching position were Michigan basketball coach John Beilein, TNT's Kenny Smith and Spurs assistant Ime Udoka.