The 30-year-old forward could have become an unrestricted free agent July 1.
"We are pleased to have signed Carl to a new four-year contract," Capitals general manager Brian MacLellan said. "Carl is a versatile player who can play on any line and is an excellent penalty killer. He is a proven winner and provides great leadership to our team."
Hagelin had 19 points (five goals, 14 assists) in 58 regular-season games with the Capitals, Los Angeles Kings and Pittsburgh Penguins this season. He had one assist in seven Stanley Cup Playoff games. Hagelin had 11 points (three goals, eight assists) in 20 games after he was traded to the Capitals by the Kings on Feb. 21 for two future draft picks. He was traded to the Kings from the Penguins for forward Tanner Pearson on Nov. 14.
"I wouldn't have signed with Washington if I didn't believe there's still a good chance to win the Stanley Cup," Hagelin said. "It starts with having [captain Alex Ovechkin], having [center Nicklas backstrom] and having (defenseman) John Carlson, players that have been in the League for a long time, know what it takes to win and great leadership. Those were our best players in the playoffs last year and they're going to continue to be that and I think that's what I like about the team. It's a good mix of veteran guys and young guys and guys that aren't that young that have been in the league for a while and understand the business."
Selected by the New York Rangers in the sixth round (No. 168) of the 2007 NHL Draft, Hagelin has 241 points (93 goals, 148 assists) in 546 games with the Capitals, Kings, Penguins, Anaheim Ducks and Rangers. He has 48 points (22 goals, 26 assists) in 128 playoff games, including winning the Stanley Cup with the Penguins in 2016 and 2017.