The Vikings are trading mercurial receiver Stefon Diggs — the author of the “Minneapolis Miracle” — to the Buffalo Bills.

In return, the Vikings will get a first-round pick in 2020 (22nd overall) along with a fifth-rounder and sixth-rounder; and a fourth-round pick in 2021. The Vikings will send a seventh-rounder in 2020 to the Bills along with Diggs.

An NFL source confirmed details of the trade.

Diggs’ touchdown catch at the end of a playoff game against New Orleans following the 2017 season was dubbed the “Minneapolis Miracle.” Diggs caught a 61-yard touchdown pass from Case Keenum on the final play of the Vikings’ 29-24 victory at U.S. Bank Stadium. It was the only playoff game in NFL history that ended on the final play of regulation.

But Diggs and Kirk Cousins, the Vikings quarterback the past two seasons, had an up-and-down relationship, despite Diggs catching 165 passes in that time.

When Cousins got a two-year contract extension on Monday, Diggs reignited intrigue about his future in Minnesota.

Hours after Cousins’ deal was announced, Diggs mused, “It’s time for a new beginning,” and when a fan pointed out his history of cryptic social media posts, he responded, “Nah this ain’t one of them times champ. Something’s going to happen.”

Bills quarterback Josh Allen (@JoshAllenQB) tweeted: “Ya dig?” and Diggs (@stefondiggs) tweeted “LET’S GET IT.”

A fifth-round pick out of Maryland in 2015, Diggs was fourth in the NFL last season with an average of 17.9 yards per catch.

Stefon Diggs' career statistics

The 26-year-old caught 365 passes in five seasons, including 102 in 2018. He had 63 catches for a career-high 1,130 yards last season.

Diggs is signed through 2023, and his $10.9 million base salary becomes fully guaranteed this week.

The Vikings would absorb $9 million of dead money in a Diggs trade, but clear another $4.9 million in cap space.

The Vikings already had the 25th overall pick in the first round for the April draft.