Massimiliano Allegri has revealed he signed an agreement to become Real Madrid head coach before opting to return to Juventus.

The Italian guided the Bianconeri to two Champions League finals, in 2015 and 2017, while winning 11 trophies during his five-season stay, including five straight Serie A titles and four consecutive Coppa Italias.

However, Allegri was dismissed by Juve president Andrea Agnelli at the end of the 2018-19 campaign, with a quarter-final Champions League exit to Ajax defining the season in which they signed Cristiano Ronaldo as a failure.

Spells with Maurizio Sarri and Andrea Pirlo yielded unsuccessful returns for Juve, who brought back Allegri at the start of this season, but the 54-year-old almost became the Madrid boss.

"I had already signed with [Madrid] last summer, but I called the president [Florentino Perez] to tell him that I would not go because I had chosen Juventus," Allegri said in an interview with GC, as quoted by CalcioMercato. "He thanked me. When they called me in May, I had no doubts.

"I have no regrets, it would have been a great professionally: Milan, Juventus, Real Madrid… but you can't have everything in life. I am proud to have coached Milan for four years and to be at Juventus now.

"I rejected Real Madrid twice. The first time I was in talks to extend with Juventus. I told Florentino that I had already given my word to Agnelli."

Allegri did not take up a managerial role between his exit and return to Juve, and believes he made the right decision to come back at the time he did.

"It was the right time. I could have returned earlier, but I didn't do it because of personal reasons," he added.

"My mother died in 2018, so I didn't want to go too far away. I remained close to my son Giorgio and my father, who was severely affected by the death of my mum. He still lives in Livorno.

"I decided to return to Juventus because I have a strong bond with the club and the owners, but also to stay closer to my son, who lives in Turin with his mother. I like to be close to my loved ones."

The Juve head coach will be hoping his side, who are fourth in the league and seven points adrift of leaders Milan, can continue their strong run of form when they host Inter on Sunday.