Trae Waynes, a former first-round pick who played the past five seasons for the Vikings, agreed to a free-agent contract with the Cincinnati Bengals.

The 27-year-old cornerback will get $42 million over the next three seasons.

Waynes, the 11th overall pick in 2015 out of Michigan State, was a starter at left cornerback the past three seasons for the Vikings, who are also likely to lose cornerbacks Xavier Rhodes and Mackensie Alexander in free agency as well. Rhodes, a three-time Pro Bowl player, was released from his contract last week.

Safety Anthony Harris received the nonexclusive franchise tag Monday, but the Vikings are open to trading Harris for a draft pick, according to NFL Media.

Waynes, who has seven career interceptions, is expected to earn $14 million annually on the new deal, which priced him out of the Vikings’ plans as the front office juggles with limited cap space and stockpiles draft picks. Unrestricted free agents can officially sign at 3 p.m. Wednesday when the NFL’s new league year begins.

After losing cornerback Darqueze Dennard to the Jaguars on Tuesday, the Bengals defense will replace him with Waynes.

Waynes had a career-worst 105.6 passer rating on balls thrown in his direction last season, according to Pro Football Focus. That ranked him 56th among cornerbacks.

The Vikings likely will sign a veteran cornerback, safety or both before free agency is over.

They were among the runners-up Tuesday in signing former Cowboys safety Jeff Heath, who instead agreed to a two-year deal worth up to $8 million with the Las Vegas Raiders, according to a league source. Heath, undrafted in 2013 out of Saginaw Valley State, was a three-year starter for Dallas and would have given the Vikings ample depth, if not more, should Harris be traded.

The Vikings only have nine defensive backs signed for 2020 and beyond. That includes only two — safeties Harrison Smith and Harris — with more than five NFL starts.