James Harrison is trading his black and yellow for silver and blue. (Keith Srakocic/AP)

James Harrison, a longtime member of the Steelers and winner of two Super Bowls while in Pittsburgh, is switching his allegiances.

Harrison signed a deal with the New England Patriots, landing the 39-year-old linebacker on the opposite side of a bitter AFC rivalry just in time for the start of the postseason.

With a week to go, the Patriots (12-3) sit atop the AFC with the Steelers (12-3) just behind in the No. 2 slot, potentially setting up a rematch of last year’s AFC championship game, in which New England was a 36-17 winner. It would be the third such meeting between the teams in which Harrison would play, but the first where he’d be cheering for — and not chasing down — quarterback Tom Brady.

Harrison and Brady already seem to be making the transition from foes to friends well enough, as the former Steeler playfully posted to Instagram about his new teammate’s age. “Finally… A teammate that’s older than me!” he wrote.

Finally… A teammate that’s older than me!😂😂 @tombrady

A post shared by James Harrison (@jhharrison92) on

Brady, 40, is the fifth-oldest active player in the NFL; Harrison is the seventh oldest.

Pittsburgh cut Harrison, the team’s all-time leader in sacks with 80½, on Saturday. Harrison had played sparingly this season, appearing in five games and finishing his final campaign with the Steelers with just one sack and three tackles.

“There was no animosity or bad feelings. It’s just the business of the NFL,” Bill Parise, Harrison’s agent, told ESPN’s Josina Anderson.

Harrison might not have any bad feelings about being cut, but Steelers fans might about where he landed. The Steelers have historically struggled against the Patriots in the playoffs, losing 4 of 5 meetings dating to a divisional-round game after the 1996 season. Harrison, who had a 100-yard interception return for a touchdown in Super Bowl XLIII, lost twice in the postseason to the Patriots, including last year’s AFC title game, likely his last playoff appearance as a Steeler.

“I’ve played with that guy for a long time,” Steelers quarterback Ben Roethlisberger said Tuesday of Harrison’s release. “He’s one of the best that I’ve ever played with. Great teammate. So it was shocking. I was a little surprised.”

Of course, this isn’t the first time Harrison and the Steelers have parted ways. He was released in 2013 and snatched up by the Cincinnati Bengals. He returned to Pittsburgh the following year, initially signing a one-day contract to retire as a Steeler before joining the active roster and recording 5½ sacks in four games. The Patriots likely are hoping for a similar burst of production from the veteran; New England’s front seven has been subpar for much of the 2017 season and is tied for 12th in the league in sacks (38).

And while Harrison hasn’t produced much this season, if the Patriots were to meet his former team in the AFC title game, Harrison’s familiarity with the Steelers could lend an edge to the New England defense. There’s also the added motivation of facing his former team to add to the equation.

Regardless of the circumstances, Harrison, who has played in 19 postseason games in his career, is back on a roster and in contention for a third Super Bowl ring. And this time, he doesn’t have to get past the Patriots.

Read more from The Post:

The Eagles are the NFC’s No. 1 seed, but they look nothing like a Super Bowl team

An NFL owner says ‘we have to fix’ replay as the league struggles with another controversial overruling

Why Kirk Cousins wants to talk with Redskins fans after the season ends

‘It was everything I dreamed of’: Texans’ David Quessenberry makes an emotional return after battling cancer

NFL teams think the Packers should have to release Aaron Rodgers over IR move. (It’s not going to happen.)