The Orlando Magic agreed to a contract extension with Jamahl Mosley on Tuesday, keeping the head coach that has turned the franchise around in the fold through the 2027-28 season.

Mosley was named head coach of the Magic in July 2021 after spending time as an assistant with the Denver Nuggets, Cleveland Cavaliers and Dallas Mavericks.

Orlando went 22-60 in his first season in charge in 2021-22 and wound up winning the NBA Draft Lottery.

The Magic used the No. 1 overall pick in 2022 on Paolo Banchero, who went on to win the NBA Rookie of the Year Award last season as Orlando finished 34-48 and missed the playoffs for the third straight year.

This season, the Magic are 37-28 and currently lead the Southeast Division by 1.5 games over the Miami Heat.

Orlando’s .569 winning percentage is its highest since posting a 52-30 record (.634) in 2010-11.

“Jamahl and his staff have done a tremendous job not only this season, but since we hired him back in 2021,” Magic president of basketball operations Jeff Weltman said.

“His preparation, work ethic, ability to connect with the players and passion he brings to the job every day brings positive results, both on the court and off.

“We are very happy to have Jamahl lead the Magic for years to come.”