Kobe Bryant, Dirk Nowitzki. And maybe Tim Duncan.

That's your trifecta of tenure, your lords of loyalty in the NBA.

When Nowitzki agreed to a two-year contract to stay with the Mavericks on Tuesday, he set himself up to play for 20 years with the same franchise. Bryant just rode into retirement after his 20th season with the Los Angeles Lakers. Duncan is weighing a 20th season coming up with San Antonio.

For Nowitzki, it was never a matter of whether he was going to abandon Dallas. He wasn't.

He wants a chance to win. And if owner Mark Cuban showed him a trace of that similar competitive fire, Nowitzki was staying.

So he's back with a golden parachute of a contract -- two years, roughly $40 million, two sources said.

Nowitzki, spending time in Europe, confirmed what everybody knew early Tuesday, telling a German reporter he was "definitely staying in Dallas."

The only question was what paycheck he would be receiving, and while he's getting a nice raise, he's still giving the Mavericks a hometown discount.

If you're on mobile, tap here to see the tweet.

He could have signed for as much as $31 million in the first season. It continued the trend that he started in 2010-11 of taking less money to give Cuban more flexibility when it came to building a roster.

This time, it's more tilted to Nowitzki's side, even though it is well below the maximum.

Bryant made $55 million in his last two seasons and spent them with miserable teams in LA.

Cuban doesn't want the same fate for Nowitzki. He is trying to put together a competitive roster this season, while at the same time getting the Mavericks younger and trying to hold onto youthful pieces that will be part of a future core.

Plus, next summer is a whole new ballgame in free agency.

So Nowitzki has hope. He expects his final season(s) to be fun. That's all he asks.

While Mavericks officials would not comment on the record, it was clear that there was a collective sigh of relief at American Airlines Center, where minicamp opened for players on the Las Vegas Summer League team.

Justin Anderson, the promising second-year wing man, is one of those participating on the summer squad. His stall is right next to Nowitzki's in the Mavericks' locker room. He said he's both pleased and impressed that Nowitzki is sticking around.

"The loyalty he has to this city, it doesn't go unnoticed," Anderson said. "This is the program that brought him in. And this is the program he's going to leave with.

"I would have missed him [if he'd left]. I would have been really angry at him, actually. Now, I get my locker buddy back and I get to keep calling him '6' until he gets up to No. 5."

That would be a reference to Nowitzki's status as the sixth-leading scorer in NBA history.

The signing of Nowitzki can't become official until 11:01 p.m. Wednesday.

The same goes for Deron Williams, Dwight Powell, Harrison Barnes and Seth Curry, all of whom have agreed to free-agent deals.

In addition, the Mavericks expect to quickly finalize the trade for center Andrew Bogut soon after the moratorium on transactions is lifted.

Nowitzki is coming off a season in which he was the Mavericks' leading scorer at 18.3 points per game. He is likely to be joined in the Mavericks' starting lineup by Bogut, Harrison Barnes, Wesley Matthews and Williams.

The goal remains for Cuban, president of basketball operations Donnie Nelson and coach Rick Carlisle to find another player to replace Nowitzki as the Mavericks' top scorer.

That said, life will be better for everybody with the two-decade man returning.

Twitter: @ESefko