The Donatas Motiejunas saga has finally come to an end as the Houston Rockets have matched the Brooklyn Nets' four-year, $37-million offer sheet he signed on Friday, according to Adrian Wojnarowski of The Vertical.

The Rockets have released guard Bobby Brown to accommodate the 7-footer into their roster.

Houston and Motiejunas have been haggling all summer long and now a month-and-a-half into the regular season, and after all, it seems to have paid off for the Lithuanian big man, who'll get a beefy $9 million per year if he can remain healthy.

“There aren't many 7-foot players who have the skills that D-Mo possesses,” team owner Leslie Alexander said, according to Fox 26 in Houston.

The 26-year-old will need to pass a final physical with the Rockets before the two sides can put pen to paper on the deal.

The Nets had signed Motiejunas to a partially guaranteed deal that could likely be worth $35 million, which turned out to be a relatively soft financial hit for the Rockets.

This deal will guarantee the dynamic forward/center $5 million and the Rockets will have to decide by Jan. 10 whether to pay him another $3.5 million for the remainder of the 2016-17 season, according to league sources. By March 1, the team has to pick up the option for $9 million owed to Motiejunas for the 2017-18 season, sources said.

The last two years of the contract are non-guaranteed, which would mean the team can cut Motiejunas without the need to pay the remaining salary on the contract. Prior to the 2018-19 and 2019-20 seasons, there’s a July 7 trigger date to make a decision on the deal. Each of the four years includes a $1 million bonus stipend and $500,000 in unlikely bonuses, according to league sources.