FORT COLLINS — Florida and Colorado State finally struck an agreement Thursday morning on the terms of Jim McElwain’s buyout, and the Gators shortly thereafter confirmed his hiring as their new coach.

As part of the agreement, CSU will receive $5 million and $2 million to play a game at Florida between 2017-20. Florida officials said McElwain will pay $2 million of the buyout — technically termed “liquidated damages” — and that CSU will receive the other $3 million from Florida over six years.

If all added together, the $7 million total is $500,000 less than the $7.5 million initial buyout in McElwain’s contract, negotiated by then-athletic director Jack Graham, signed last June and announced in August. The contract called for “liquidated damages” to be “paid in full on a lump-sum basis within 30 days” of McElwain accepting another job, so the terms were part of the negotiations.

McElwain’s CSU contract included provisions for annual rollovers that could be triggered by either side. It also had an “extenuating circumstances” clause if McElwain signaled his intention to terminate the contract “without cause,” which could lead to discussions about reducing the buyout. Yet the contract noted that CSU had “no obligation” to reduce the buyout “in whole or in part.”

CSU said the deal is the largest buyout in college football history, surpassing the $4.3 million Texas paid to Louisville to get Charlie Strong earlier this year.

“It was important to hold firm to that buyout,” CSU interim athletic director John Morris said Thursday afternoon. “And it’s important … that you have a coach who wants to be here. So we’re very pleased with how that turned out.”

He said he couldn’t comment on whether CSU considered sticking to the demand for $7.5 million paid within 30 days.

McElwain will receive $3.5 million annually over six years from Florida. He is the first head coach in CSU history to leave to coach another program, as all previous head coaches retired or were fired.

Rams offensive coordinator Dave Baldwin, 59, was named interim coach for CSU’s upcoming bowl game.

CANDIDATES FOR CSU GIG: Here are 12 worth a call

“CSU athletics has benefitted from the three-year association with Jim McElwain,” CSU President Tony Frank said in a statement released shortly before noon. “We wish him well, and are confident we can recruit a coach who is committed to a sustained program of excellence at Colorado State over the long term.”

McElwain met with CSU players around 9:25 a.m. for about eight minutes and was greeted with applause. He left without commenting to the assembled media. The players remained in the auditorium with Morris for a few minutes, and most went as a group to the nearby locker room.

After the meeting, the players were discouraged from talking with the media, but junior H-back/tight end Steven Walker, an all-Mountain West choice, said they had been told that Baldwin would be the interim head coach, and CSU confirmed that later.

“It’s something we have to go through as a team,” Walker said. “Coach Baldwin’s a great coach and we’re going to get a victory in this bowl game. It’s a change for us, but we’re going to get through it as a team.”

Did the players feel let down by their coach?

“No, not at all,” Walker said. “He had to take an opportunity for himself and for his family. We’re happy for him. He’s going on to a great program and he’s going to do what he has to do.”

The Rams went through a light no-pads workout under Baldwin Thursday afternoon, and then the players were allowed to comment.

Junior running back Dee Hart, the Rams’ leading rusher, transferred from Alabama to Colorado State and rejoined McElwain for this season. Hart, one of the nation’s most-sought recruits in the Class of 2011, hadn’t been able to break into the ball-carrying rotation at Alabama after suffering knee injuries, and he made the most of a second chance at CSU.

Hart visited McElwain in his office Thursday. “He thanked me a lot for coming here and for helping him get where he is now, and he let me know he really appreciated it. I’m very happy and excited for him. He’s a coach I have loyalty to and I came in here for him. At the same time, I know what the goal in life is for different guys. That can be SEC football, that’s what he chose to do and I think he made the best decision for him and his family. In the broader perspective of life, that’s what we all have to think about.”

Hart said he had no problem with staying at CSU without McElwain.

“I’m happy and thankful,” he said. “I have my family and friends here, a lot of guys who have accepted me in this program, and I have a lot of teachers and staff members who have accepted me. It’s a big deal to me that I stay and finish up my career here. I started something here. I need to finish it.”

Sophomore wide receiver Rashard Higgins was lightly recruited out of high school in Texas, was given a chance by the McElwain staff, and now is one of three finalists for the Biletnikoff Awards as the top wide receiver in the country.

“I give credit where credit is due,” Higgins said. “Coach Mac got a higher job at Florida and maybe he can lead his team to a national championship there.”

Higgins added, “He’s worth every penny. He’s a great coach. There’s no downside. He’ll do good at Florida.”

Higgins would have to sit out a year if he transferred, but he said he hadn’t given any thought to leaving. “We’ll have to adapt to the new coaching,” he said. “I’m pretty sure somebody will pick a great coach.”

A contingent of Florida officials — including athletic director Jeremy Foley — was in Fort Collins on Tuesday and Wednesday to meet with McElwain. Florida athletic director Jeremy Foley left Wednesday afternoon, and after CSU initially refused to budge on the $7.5 million buyout, the deal was consummated early Thursday.

CSU now is operating with both an interim AD (Morris) and an interim head coach (Baldwin) as Frank prepares to meet with the CSU system board of governors in Denver Friday to formally deliver his recommendation to move ahead with the on-campus stadium project.

Before the statement was released, Frank declined immediate comment on McElwain’s departure, but said of the imminent board meeting: “The stadium is a long-term decision for the university that goes well beyond one individual. I will be making my same recommendation to the board tomorrow as scheduled.”

Morris, formerly the associate AD at Washington, joined CSU in 2012 as assistant AD. He has been the top officer in the athletic department since the firing of Jack Graham in August. The search process to name a new AD was on hold until the future of the stadium project was decided, but Morris has said he hopes to be considered for the job.

Morris said he would be involved in the coaching search, but that Frank would lead it. “There will not be any sort of search committee,” Morris said.

Morris said of the CSU job: “This is a fantastic place to be a head football coach. This is a dream job, this is a destination job, and we are already attracting amazing candidates from the highest levels of football. . . I cannot commit to a timetable. We will hurry, but we will not rush. We need to get this done, but more important, for our student-athletes and our fans, we need to get this done right.”

He said CSU had heard from “north of 40 to 50 candidates — impressive ones. It’s staggering, frankly.” He added, “We will hire someone who wants to be at Colorado State long-term.”

Morris said not getting all the buyout money upfront wouldn’t affect what CSU could offer the next coach.

Baldwin, the former head coach at San Jose State, has worked with McElwain at both Michigan State — where McElwain was receivers coach and Baldwin the offensive coordinator — and CSU, said he “definitely” would like to be considered as McElwain’s successor.

“That’s why I’m in the business,” Baldwin said. “I’ve been a head coach. I came here with Coach Mac for a purpose.” He cited Boise State, San Diego State and Utah State as examples of successful programs that have elevated a staff member after the head coach left.

Baldwin said he would continue to call plays at the bowl game.

Morris said of the possibility of staying in-house for the coach choice: “We owe it to our student-athletes to do a national search to find the best candidate to lead this program. In football, especially with signing day a couple of months away, with a program that is succeeding with a system that’s working, your term was ‘continuity,’ that is a huge factor that needs to be considered. We have exceptional coaches and I expect that we will have at least one very strong internal candidate.”

CSU went 10-2 this past season and will learn Sunday where it will play in a bowl game. In three years, McElwain, who took over a program that had gone 3-9 for three consecutive seasons, won four, eight and 10 games.