Patrik Elias is staying in New Jersey after the Devils forward agreed to a three-year, $16.5 million contract on Thursday, one day before he was eligible to become an unrestricted free agent.

Elias’ agent, Allan Walsh, announced the terms of the deal on Twitter.

Elias has spent his entire 15-year career with the Devils. He leads the franchise with 375 goals, 555 assists and 930 points in 1,090 career games and holds team playoff records with 45 goals, 80 assists and 125 points.

He has led the Devils in points in eight seasons, including this past year when he finished with 36 points (14 goals, 22 assists) in 48 games.

Selected by New Jersey in the second round of the 1994 draft, the Czech-born Elias has topped 70 points in a season five times. That includes the 2011-12 season, when he had 78 points (26 goals, 52 assists) in 81 games.

New Jersey also re-signed veteran forward Dainius Zubrus to a three-year, $9.3 million contract. Zubrus is a 16-year NHL veteran, who has spent the past six seasons with New Jersey.

Zubrus had two goals and seven assists in 22 games last season. He missed 26 games after having surgery to repair an injured left wrist.

New Jersey is expected to lose forward David Clarkson, who will test free agency today. Forwards Steve Sullivan, Alexei Ponikarovsky and defenseman Marek Zidlicky also are eligible to become unrestricted free agents.

The Devils also placed veteran backup goalie Johan Hedberg on unconditional waivers for the purpose of buying out the final year of his contract.

Hedberg went 6-10-3 with one shutout last season. Overall, he is 161-143-36 with 22 shutouts.

Started at The Press in 1993 as an Ocean County reporter. Moved to the copy desk in 1994 until taking over as editor of At The Shore in 1995. Became deputy sports editor in 2004 and was promoted to sports editor in 2007.