Hampus Lindholm plays for the Ducks against Pittsburgh on Feb. 8. (Gene J. Puskar / Associated Press)

After nearly four months of negotiations and moving pieces around, the Ducks signed defenseman Hampus Lindholm to a six-year contract extension Thursday worth $5.25 million annually.

The deal, first reported by TSN, pays $3 million the first year and $6 million, $6.75 million, $5.25 million, $3.75 million and $6.75 million in the ensuing seasons.

The Ducks are up against the salary cap. They were able to make the deal because defenseman Simon Despres is on long-term injured reserve, so his $3.7-million salary is not on the books. Anaheim would have to move money out, likely via a trade, in order to be cap compliant once Despres comes off injured reserve from concussion-like symptoms.

Despres is seeing specialists, and his timetable for a return is indefinite. Center Nate Thompson is also on long-term injured reserve and is expected to be out until mid-season).

The extension keeps Lindholm under contract through the 2021-22 season. The 22-year-old is the closest the Ducks have to a true No.1 defenseman, a swift puck-mover who is potentially a franchise cornerstone player.

Lindholm was their leading goal-scoring defenseman last season with 10 goals and has 92 points in 236 games with Anaheim. He led the Ducks with 115 blocked shots last season. Since his debut in the 2013-14 season, Lindholm’s plus-61 rating is third among NHL defensemen.

Those numbers are partly why Lindholm’s camp was reportedly seeking an extension worth about $5.5 million annually. The comparable was Buffalo defenseman Rasmus Ristolainen, another holdout who signed for $5.4 million annually.

Lindholm’s agent, Claude Lemieux, told The Times on Sunday that there wasn’t any progress. But there has been urgency to find common ground for both sides because Lindholm has already missed eight games. He is in Sweden and, like recently re-signed teammate Rickard Rakell, needs to obtain a work visa to return to California.