LAWRENCE, Kan. — Les Miles is headed back to the Big 12 and another massive rebuilding job, this time taking on the downtrodden program at Kansas in a splashy hire aimed at energizing a weary fan base.

The deal was finalized shortly before Miles arrived at the airport in nearby Topeka on Sunday. Miles signed a five-year contract that will pay him $2,775,000 annually with retention bonuses of $775,000 due in November 2020 and $500,000 in November 2022.

"Since the beginning of our search, we focused on identifying and recruiting an experienced head coach with a track record of success on and off the field," Kansas athletic director Jeff Long said in a statement. "Les Miles is exactly what we need right now."

Miles was considered the front-runner for the Jayhawks' job from the moment David Beaty was told he would not be retained two weeks ago. The 65-year-old Miles has a close relationship with Long dating to their days together at Michigan, and Miles had told those around him he wanted back in coaching.

Miles and Long had been in frequent contact over the past two weeks, and it became clear a deal was close when LSU announced Thursday it had agreed to a buyout with its former coach. Miles agreed to a lump sum of $1.5 million of the remaining $6.5 million he was owed under terms of his buyout.

The school has planned an introductory news conference for later Sunday.

"I am humbled by the opportunity to lead the KU football program and I am grateful for Chancellor (Doug) Girod and Jeff Long for the opportunity," Miles said. "We will bring Jayhawk Football back and we will do it with outstanding coaches, tremendous student-athletes of character and ability and un unrelenting drive for excellence. My family and I cannot wait to be part of the KU family."

The quirky Miles has been out of coaching since 2016, when he was fired by LSU after a 2-2 start. His support among Tiger fans had waned considerably in a span of just a few years, even though Miles won at least 10 games in seven of his 11 full seasons, twice reached the national title game and beat Ohio State for the 2007 championship. He went 114-34 at LSU.

The most vocal critics argued that Miles had been unable to keep up with the times, sticking to an unexciting and often-stagnant attack during college football's offensive explosion.

Miles had inherited a winner when he was chosen by LSU to succeed Nick Saban in 2005, but he had proven with Oklahoma State that he could also build a program from scratch.

The Cowboys had just one winning season in 12 years before Miles, their program in similar shape to the Jayhawks. But the longtime college and pro assistant thrived in his first head job, finding some overlooked prospects, developing them and eventually reaching three straight bowl games. He was 28-21 at Oklahoma State.

"I have no doubt that Coach Miles will have an immediate impact on our football program and our university," Girod said. "Together as Jayhawks, we will rebuild our football program the right way, winning championships and continuing to graduate young men of character."

The Jayhawks haven't had a winning season or reached a bowl game since 2008, the year before Mark Mangino was forced to resign under pressure. Turner Gill won five games over two seasons before getting fired, and Charlie Weis managed six wins in two-plus seasons before he was let go.

By that point, the program had become the laughingstock of the Big 12.

The Jayhawks were woefully short on scholarship players, their facilities were decrepit, their fanbase had grown apathetic and the even the administration seemed to have little interest in supporting football. Beaty's contract lagged far behind his peers financially, and there was little money at his disposal for hiring assistant coaches and other administrators.

Long has promised to rectify those issues, even announcing that a $300 million renovation to aging Memorial Stadium had been put on the backburner while money was invested in the program itself.

The first and most important investment came in the head coach.

Miles would earn $15.125 million by fulfilling his five-year contract. He also can earn a series of incentives: $1 million for reaching the national title game; $350,000 for a playoff semifinal; $100,000 for a New Year's Six game; $100,000 for making the Big 12 title game; and $75,000 for any other bowl game. Miles also can earn $50,000 each for being the Big 12 and national coach of the year, $15,000 for having a Broyles Award-winning assistant, and up to $50,000 for the team's GPA.

His contract also includes a one-year, one-time rollover extension that is triggered by winning six games in a season, and benefits such as a country club membership and moving expenses.

The Jayhawks, who lost to sixth-ranked Oklahoma on Saturday to leave Beaty with a 6-31 record in three-plus seasons, will finish out their year under their former coach Friday against Texas