Robin Lopez, Knicks agree to deal after DeAndre Jordan chooses Mavs

Robin Lopez has agreed to a deal with the New York Knicks, the free-agent center tweeted Friday.

The deal is for four years with a total value of $54 million, sources told ESPN.

Lopez chose the Knicks over the Los Angeles Lakers, sources said. His deal with New York went through after DeAndre Jordan came to terms with the Dallas Mavericks.

The Knicks met Thursday with Jordan, and if he had chosen New York, the Lopez-to-Knicks deal would have been called off.

Lopez is the second free agent picked up by Phil Jackson and the Knicks in the 2015 offseason. On Thursday, New York agreed to a two-year, $16 million contract with Arron Afflalo.

New York also had a meeting scheduled with free agent LaMarcus Aldridge, but he canceled the meeting Thursday afternoon, a source confirmed. The Aldridge cancellation came hours after the Knicks found out they had fallen short in their pursuit of Greg Monroe, who agreed to a three-year, $50 million contract with the Milwaukee Bucks.

It was an ugly turn for Jackson, who had said he planned to rely heavily on free agency to rebuild the Knicks. But New York got a solid secondary option in Lopez.

Lopez is known as a strong defender and rebounder, two areas in which last season's 17-win Knicks struggled. The 7-foot center averaged 8.7 rebounds per 36 minutes last season, including 4.2 on the offensive end.

The 27-year-old Lopez played the past two seasons with the Portland Trail Blazers. He was selected 15th overall by the Phoenix Suns in 2008, playing his first four seasons there. The New Orleans Pelicans acquired him via sign-and-trade in 2012, with Lopez starting all 82 games that season. The Blazers acquired him in a three-team trade before the 2013-14 season.

He recorded 29 double-doubles and set a franchise record for offensive rebounds in his first season with the Blazers. He missed 23 games last season with a broken hand suffered in December but still averaged 9.6 points, 6.7 rebounds and 1.4 blocks per game, anchoring Portland's interior defense.

A seven-year veteran, Lopez holds averages of 8.2 points and 5.0 rebounds in his career's 465 games.

His twin brother, Brook, plays across town in New York with the Brooklyn Nets.

ESPNNewYork.com's Ian Begley and ESPN.com's Royce Young contributed to this report.