Zlatan Ibrahimovic has played his last game for Manchester United ahead of a move to MLS, with sources telling ESPN FC the Swedish striker has signed a two-year contract with the LA Galaxy.

The Premier League club confirmed on Thursday they had agreed to immediately terminate Ibrahimovic's contract, which had been set to expire in June, after ESPN reported hours earlier that he was headed to MLS.

The Galaxy will pay Ibrahimovic $3 million total using targeted allocation money, sources confirmed. The 36-year-old will not be a designated player, with LA already using its three allotted slots for highly paid players on Giovani dos Santos, Jonathan dos Santos and Romain Alessandrini.

The deal is expected to be announced by the end of the week, sources said. He could conceivably make his debut on March 31 in his new club's first-ever game against MLS expansion team LAFC, the Galaxy's new local rivals.

Ibrahimovic, who joined United from Paris Saint-Germain on a free transfer in 2016, has not played since aggravating a knee injury against Burnley on Dec. 26.

And with less than four months remaining on his Old Trafford contract, sources told ESPN FC that United manager Jose Mourinho has allowed Ibrahimovic to leave now in order to move to MLS.

"Everyone at the club would like to thank Zlatan for his contribution to the team since his arrival and wishes him well for the future," a United statement read.

Ibrahimovic also posted a statement on Instagram, saying: "Great things also come to an end and it is time to move on after two fantastic seasons with Manchester United. Thank you to the club, the fans, the team, the coach, the staff and everybody who shared with me this part of my history."

Zlatan Ibrahimovic's appearance against Burnley on Dec. 26 was his last for Manchester United. Matthew Ashton/AMA/Getty Images

The Galaxy deal ends nearly two years of discussions between MLS and Ibrahimovic's representatives to bring him to North America. Talks began in May 2016, before the Swede opted to join United, and ESPN reported in January that the Galaxy were inching closer to signing the striker.

ESPN first reported the news of Ibrahimovic's impending departure to MLS on a TAM deal on Thursday, and subsequently the Los Angeles Times reported that he had completed his contract with the Galaxy, and Sports Illustrated followed with the details of the contract.

Ibrahimovic scored 29 goals in 53 appearances for United, including two in the EFL Cup final win against Southampton last season.

However, United's £90 million purchase of Romelu Lukaku last summer pushed Ibrahimovic to the sidelines at Old Trafford, and though he is now set to call time on his Premier League career, he is determined to continue his career after returning from a serious knee injury at United earlier this season.

Ibrahimovic has recently returned to full training with United, but he told Reuters last week that he did not want to rush his comeback, insisting he would not return until he is "ready to perform."

Despite ending his international career for Sweden in 2016, Ibrahimovic said earlier this month that he has not ruled out returning to play at the World Cup in Russia this summer.

ESPN FC's Jeff Carlisle contributed to this report.