MUNICH — Coach Pep Guardiola will leave Bayern Munich at the end of the season and will be replaced by Carlo Ancelotti, the German soccer powerhouse said Sunday.

Ancelotti, winner of three Champions League titles, signed a three-year deal, Bayern said.

“When I knew of the club’s interest I didn’t want to consider any other offer. I honestly wish Bayern Munich and my friend Pep Guardiola the best for the current season,” Ancelotti said.

Despite the club’s willingness for him to stay on, Guardiola decided to leave after three seasons in charge.

“We are very thankful to Pep Guardiola for everything he has given our club since 2013,” Bayern chairman Karl-Heinz Rummenigge said. “I am sure that Pep and our team will work even harder to achieve great sporting goals now that it’s certain that Pep will leave Bayern.”

In the same statement, Ancelotti said “it’s an honor for me to be a part of this great club next season.”

Rummenigge said Ancelotti was “a calm, balanced expert, who can deal with stars and can play a flexible game.”

“What we sought, we found,” Rummenigge said.

Guardiola, who took over Jupp Heynckes’ treble-winning side in 2013, led Bayern to the FIFA Club World Cup and UEFA Super Cup that same year, a German league and cup double in 2014, and another Bundesliga title in 2015. The side set a host of records in that time.

However, Champions League success has so far eluded Guardiola at Bayern, where comprehensive semifinal defeats to Real Madrid and former club Barcelona represent his biggest disappointments at the club. The 44-year-old Spaniard is bidding to lead Bayern to an unprecedented fourth successive Bundesliga title this season, with the Champions League and German Cup also marked as targets.

Rumor: Guardiola wants Man United job >>

Thumbnail photo via Twitter/@SkyFootball