The Vikings will have Everson Griffen back on their roster in 2019, after the defensive end restructured his contract Thursday to help provide the team some salary cap relief.

Griffen agreed to a reworked deal that will pay him up to $8 million in 2019, according to two NFL sources. The 31-year-old had been scheduled to make $10.9 million this season, with a salary cap figure of $11.743 million. His base salary was scheduled to be guaranteed for the 2019 season on Friday, so the Vikings had to decide to restructure the defensive end’s deal or release him by the close of the league’s daily waiver wire at 3 p.m. on Thursday.

Griffen can earn an extra $500,000 if he posts at least eight sacks this season, and he can void the final three years of his contract if he plays at least 56 percent of the Vikings’ defensive snaps while totaling six or more sacks in 2019.

“It was a matter of Everson sitting in a parking lot at 2:40 as I was in with [vice president of football operations] Rob Brzezinski at the time trying to hammer out and finalize the deal,” General Manager Rick Spielman said. “Rob does a tremendous job with that, as we sat there and finalized the negotiating part. He was up in my office at 2:45 and we got it signed at 2:50 and the rest is history.”

The deal comes after a busy week of negotiations between the Vikings and Griffen’s agent, Brian Murphy, who also represents linebacker Anthony Barr. On Thursday, just before the Vikings were set to hold a news conference where Barr was to talk about his five-year, $67.5 million deal, they finalized their restructured contract with Griffen.

Griffen played 11 games last season, posting 5½ sacks after returning from a five-game absence to deal with mental health issues. He had considered the possibility of turning down the team’s offer for a restructured contract, but instead opted to stay with the team that drafted him in the fourth round in 2010.

It remains to be seen whether the Vikings will keep Griffen at his customary right end spot, or consider moving him to put Danielle Hunter — who posted 14½ sacks in 2018 — on most quarterbacks’ blind side.

However the Vikings use their pass rushers — and however much they incorporate Barr into their plan after he spurned a chance to be a featured pass rusher in New York — they’ll once again have the linebacker as part of their defense, an outcome that seemed improbable earlier this week.

After signing his contract Thursday, Barr said he “feels so much better” than he did Monday night, when he initially committed to earning $15 million to $17 million per season with the Jets. Emotions churned from feeling sick to shedding tears, Barr said, as he debated his long-term future before ultimately deciding to stay for less money in the NFL locker room that raised him.

VideoVideo (05:05): Anthony Barr discusses his flip from accepting an offer with the Jets on Monday night to returning to the Vikings on a lucrative extension that will pay him less than New York's offer.

“I thought Monday was going to be a fun day,” Barr said. “Monday was one of the worst days of my life, really, trying to figure everything out. I was on the phone all day with my agent, my mom, just calling friends, teammates. It was a crazy day. I just followed my heart and did what I wanted to do at the end of the day. I’m happy with it.”

Barr, who turns 27 next Monday, said he feels like he’s “going on 37” thanks to the past couple days. He said he initially told his agent over the phone he’d take the Jets offer, before feeling instant regret.

“I kind of felt like I jumped, and then I was like, ‘Oh, man, what did I just do?’ ” Barr said. “Like instantly, I just didn’t feel right about it. I mean, it’s my life. I’ve got to live it. Nobody else has to. So I should be able to make the choice however I want it. I could change my mind 10 times if I want to. So I don’t care what nobody says about that.”