Lionel Messi signed a two-year contract with an option for three. (Photo courtesy of PSG)

It’s official.

Lionel Messi has joined Paris Saint-Germain.

The former Barcelona star signed a two-year deal with the French Ligue 1 side, with an option for a third season.

Messi, 34, left Barca after a 21-year association with the La Liga club.

“I am excited to begin a new chapter of my career at Paris Saint-Germain,” Messi said. “Everything about the club matches my football ambitions. I know how talented the squad and the coaching staff are here. I am determined to help build something special for the club and the fans, and I am looking forward to stepping out onto the pitch at the Parc des Princes.”

Messi joined PSG on a free transfer.

No salary details were given, but a person with knowledge of the negotiations told The Associated Press that Messi is set to earn about $41 million.

“I am delighted that Lionel Messi has chosen to join Paris Saint-Germain and we are proud to welcome him and his family to Paris,” PSG chairman Nasser Al-Khelaifi said. “He has made no secret of his desire to continue competing at the very highest level and winning trophies, and naturally our ambition as a club is to do the same.”

Messi made his departure from Barcelona official this past weekend after the club said it could not afford his contract because of severe league restrictions.