Evgeni Malkin has agreed to a four-year contract extension with the Pittsburgh Penguins on the eve of NHL free agency, ending a tumultuous week between the star center and the team.

Malkin, 35, will earn $24.4 million over four years for an average annual value of $6.1 million.

"Evgeni is a generational talent who will be remembered as one of the greatest players in NHL history," Penguins general manager Ron Hextall said Tuesday night in a statement.