Icardi, who has been a big success since joining on loan from Inter last summer, has signed a contract until 2024. The deal is reportedly worth £45m.
This season, the Argentina international, who holds an Italian passport, has scored 12 goals in 20 Ligue 1 games and five times in six Champions League matches. The French league winners are through to the last eight of the competition.
The move brings an end to an ill-tempered time for Icardi in Milan which resulted in him being left out of Inter's squad upon Antonio Conte's arrival last summer. Inter, however, did wish the outgoing Icardi well.
"The Club thanks the player for the six seasons he spent with us and wishes him the best for his future professional career."
Real Madrid to sacrifice superstar to land Mbappe - Euro Papers