AC Milan announced that coach Stefano Pioli has signed a two-year extension to his contract, keeping him at the club until June 2022.

Milan released a statement shortly after the team beat Sassuolo 2-1 in Serie A.

“I am happy and proud of the trust I have received from AC Milan,” Pioli said.

“As I have said many times, our future is today: We must be focused and determined, be united and play as one.

“We are at the beginning of an extraordinary path. If we keep working this way, we will grow and be more and more competitive.”

Milan had been in negotiations to replace Pioli with Ralf Rangnick but the German coach’s representative released a statement earlier Tuesday saying they had jointly decided with the club not to move forward.

Milan has seen a remarkable upturn in form and results since Serie A resumed following the pandemic-enforced shutdown. The Rossoneri have won seven of their nine league games since the restart, drawing the other two.

“Stefano has shown he can deliver the vision of football we have for our club — exciting, progressive and passionate,” Milan CEO Ivan Gazidis said.

“This is not a decision based on recent victories, but one based on how Stefano has built team spirit and unity of purpose, the way he has improved the performances of the individual players and the collective team, the way he has embraced our vision and the way he has represented himself and the club’s values.”

Pioli joined Milan in October as a replacement for the fired Marco Giampaolo, who had lost four of his seven matches in charge.

After a difficult start, the 54-year-old Pioli has steered the team into fifth place in Serie A.

“Stefano stepped up to become coach at a very difficult time,” sport director Paolo Maldini said. “We have always said it would take some time to see the results of his job and we have seen the evidence that quality and professionalism always pay off.

“Stefano is the right man to lead the team that we want: successful, young and hungry.”