ALAMEDA, Calif. (AP) — The Oakland Raiders agreed on a deal Saturday night to acquire prolific but disgruntled receiver Antonio Brown from the Pittsburgh Steelers and will give him the lucrative new contract he wanted.

A person with direct knowledge of the trade told The Associated Press that the Raiders finalized the deal with the Steelers and will give Brown a new three-year contract worth $50.125 million instead of the $38.925 million he was owed by Pittsburgh. The person spoke on condition of anonymity because the deal can’t be completed until the new league year starts Wednesday.

Pro Football Talk first reported the deal and says Pittsburgh will get third and fifth-round draft picks from Oakland.

The trade makes final what became a very messy and very public divorce between Brown and the team that helped turn the sixth-round pick into arguably the greatest wide receiver of his generation.

It also gives the Raiders a high-profile addition for second-year coach Jon Gruden after trading away two of the team’s biggest stars last year in edge rusher Khalil Mack and receiver Amari Cooper.

Oakland got extra first-round picks in those trades but didn’t need to give up any of its four picks in the top 35 in the upcoming draft to acquire Brown, who has topped 100 receptions and 1,200 yards receiving in each of the past six seasons. The Raiders have had only one player reach those marks in a single season in franchise history, with Hall of Famer Tim Brown accomplishing the feat in 1997.

Brown now gives quarterback Derek Carr his biggest offensive weapon since entering the league in 2014 and the Raiders a legitimate star before they move to Las Vegas for the 2020 season.

The Raiders’ top wide receiver last season was Jordy Nelson, who had just 63 catches for 739 yards.

Gruden has always admired Brown from his time as a broadcaster and had nothing but praise for the receiver before the teams played last December.

“He’s the hardest working man, I think, in football,” Gruden said. “Hardest working player I’ve ever seen practice. I’ve seen Jerry Rice, I’ve seen a lot of good ones, but I put Antonio Brown at the top. If there are any young wideouts out there, I’d go watch him practice. You figure out yourself why he’s such a good player.”

Brown was obviously pleased with the development, posting a picture of himself in a Raiders uniform and a video with Carr at a Pro Bowl with the caption “Love at first sight ” on his Twitter account.

Brown is no stranger to drawing headlines for both his prolific on-field production and his off-the-field antics, including livestreaming from the locker room after a playoff win over Kansas City in January 2017 and getting pulled over for doing 100 mph in the northern Pittsburgh suburbs last fall.

The sometimes tumultuous relationship between the only player in NFL history with six straight 100-catch seasons and the franchise that made him the highest-paid player at his position in the spring of 2017 reached a breaking point in late December.

Steelers coach Mike Tomlin benched Brown during the regular-season finale against Cincinnati after the wide receiver went radio silent in the final 48 hours before the game. Brown arrived in a fur coat, hung out for a half and then disappeared from view until well after his teammates had cleaned out their lockers following a 9-6-1 finish that left Pittsburgh on the outside of the playoffs for the first time since 2013.

When Brown did resurface, he began engaging in a series of increasingly antagonistic acts designed to expedite his departure. He went on Instagram with former Steelers linebacker James Harrison during Tomlin’s season wrap-up press conference. He decried quarterback Ben Roethlisberger’s “owner’s mentality” and chastised Tomlin for disciplining him in Week 17, no matter that Tomlin and the rest of the organization had spent years downplaying Brown’s off-the-field eccentricities.

Brown officially requested a trade last month, but not before photo-shopping his familiar No. 84 onto a San Francisco 49ers jersey or using his hyperactive social media feeds to indicate not only his displeasure with the Steelers but also his interest in signing a new deal with whomever should acquire his services.

Even with his benching in the finale, Brown caught 104 passes for 1,297 yards and a franchise-record and NFL-high 15 touchdowns. His last performance in a Pittsburgh uniform might have been one of his best, a 14-reception, 185-yard, two-touchdown masterpiece in a road loss to New Orleans.

A week later, the player who once said he wanted to retire a Steeler didn’t even suit up against the Bengals. Just over two months later, he now finds himself heading to the second act of a career that’s on a Hall of Fame trajectory and the Steelers have a hole at receiver and more than $21 million in dead money on their salary cap.