Updated

The Pittsburgh Penguins re-signed right wing Tyler Kennedy to a two-year, $4 million contract Friday, moments before the start of free agency. Had he not signed, he would have been unrestricted free agent.

Kennedy posted a career-high 21 goals for the Penguins last season. He also set new personal bests in assists (24), points (45) and power-play goals (7). He added 3 points in seven playoff games.

The deal with Kennedy was reached not long after the Penguins announced they were taking their offer to Jaromir Jagr off the table. The Pens reportedly had offered the 39-year-old Jagr a one-year, $2 million contract.

Kennedy's agent, Steve Bartlett, had told the Pittsburgh Tribune-Review earlier Friday that he felt a deal was close to happening.

"We're still working on it," Bartlett told the newspaper. "But I am optimistic that it will get done (Friday)."

In four seasons with the Penguins, Kennedy has 56 goals and 65 assists in 266 games. He had been mostly a third-line player, but stepped up offensively in the absence of Sidney Crosby and Evgeni Malkin this season. When Malkin joined Crosby on the sideline Feb. 4, Kennedy had 12 goals and 9 assists in the final 28 games of the season.

Contact Adam Kimelman at akimelman@nhl.com. Follow him on Twitter: @NHLAdamK