Kansas hired Buffalo's Lance Leipold on Friday, turning over one of college football's worst programs to a longtime Division III coach with strong Midwestern roots.

Leipold signed a six-year contract and takes over for Les Miles, who won a national championship at LSU. Miles parted with Kansas after two losing seasons and amid sexual harassment allegations dating to his time with the Tigers.

"It is an exciting and humbling opportunity and this is a day I will never forget," Leipold said in a statement. "We are going to build this program through developing players, discipline and determination. The philosophies engrained in our programs along the way will be key as we turn this around. This is a program that has a lot of young talent on the roster and has the infrastructure in place to succeed. The best days for this program are ahead."

CLICK HERE FOR MORE SPORTS COVERAGE ON FOXNEWS.COM

Leipold has been with the Bulls the past six years, building a downtrodden program into a perennial bowl contender. He is 37-33 with Buffalo, leading the school to its best seasons since joining the Mid-American Conference in 1999.

Before jumping to the Division I level, the 56-year-old Leipold won six national championships in eight seasons while going 109-6 as the head coach of his alma mater, Wisconson-Whitewater. At one point, the Warhawks won three straight titles to cap perfect seasons, then after a seven-win "down year," put together two more undefeated seasons.

Now, new Kansas athletic director Travis Goff — who was hired away from Northwestern in April — hopes a coach with all those D-III championships on his resume can do what a coach who won a D-I title could not.

"His track record of sustained excellence is exactly what we were looking for in our next leader," Goff said in a statement Friday, "and is what the University of Kansas and our fans deserve."

Miles was hired nearly three years ago by then-AD Jeff Long to turn around one of the worst Power Five programs in college football history. Instead, the Jayhawks went winless in nine games during the COVID-19-shortened 2020 season, the 12th straight in which they failed to hit the .500 mark or win more than one Big 12 game.

Miles was then let go in March after sexual misconduct allegations surfaced. A law firm’s review of LSU’s handling of sexual misconduct complaints campuswide described how Miles "tried to sexualize the staff of student workers in the football program" before he was fired four games into the 2016 season.

Leipold played quarterback for Wisconsin-Whitewater in the 1980s before beginning a long grind through college football's lower ranks. He spent time at Doane, an NAIA school in Nebraska, and several seasons coaching at Nebraska-Omaha, whose football team was later disbanded to save money.

His only Division I experience before Buffalo hired him in 2015 was a stint as a graduate assistant under Barry Alvarez at Wisconsin in the early 1990s and some time with Frank Solich at Nebraska in the early 2000s.

Leipold took over a Bulls team that had regressed under Jeff Quinn and had played in only two bowl games before his arrival. Leipold endured two losing seasons before winning at least six games each of the past four years, twice playing for a MAC title and going 6-1 during the pandemic-shortened 2020 season.

That put him on the radar for several high-profile openings earlier in the coaching carousel.

The Jayhawks certainly have higher hopes for Leipold than the last coach they hired from Buffalo. Turner Gill was just 5-19 over two seasons in Lawrence before he was fired, beginning a whirlwind of hirings and firings: Charlie Weis lasted parts of three seasons, David Beaty survived four and Miles was let go after two.

Along with the Jayhawks' history of losing, Leipold will have to overcome a substantial talent gap in the Big 12, fan apathy that has only grown over the past decade and facilities — despite a new indoor practice field — that are woefully outdated.

"I can’t thank Lance enough for everything he has done for our football program," Buffalo athletic director Mark Alnutt said. "His vision and leadership helped elevate the UB football brand. We are grateful for what Lance has done here and we wish him and his family all the best as they embark on this new journey."