J.J. Barea has signed a four-year, $16 million deal with the Dallas Mavericks.

Barea originally agreed to sign a two-year, $5.7 deal with the Mavericks with the cap room exception but the sides negotiated a new deal after DeAndre Jordan backed out of his deal.

"They knew I wanted to be there for a long time," Barea told ESPN.com. "They wanted me there for a long time, so we made it happen."

Barea returned to the Mavericks before last season for the final season of his four-year, $18 million deal with the Minnesota Timberwolves.