Months before Nike unveiled Colin Kaepernick as the face of their 30th anniversary "Just Do It" campaign, the sports apparel giant was engaged in vigorous debates over what to do with the unemployed quarterback.

Nike nearly cut ties with Kaepernick before reversing course and embracing what he stood for, according to a story in the The New York Times.

A Nike athlete since 2011, Kaepernick’s dilemma left Nike marketing officials unsure of how to proceed with the polarizing quarterback. Complicating matters, Nike also had a preexisting deal with the NFL, which reportedly paid the league $220 million annually to place its swoosh on officially licensed merchandise. That deal was extended, with amendments to the agreement, this past March for 10 years.

It took an intervention from Nigel Powell, Nike’s head of communications, before Nike decided to support Kaepernick. According to The New York Times, Powell argued that cutting ties with Kaepernick could lead to repercussions in the media as well as consumers.

Its executives, in collaboration with Nike’s longtime ad agency Wieden and Kennedy, eventually recognized there could be significant value in positioning itself alongside Kaepernick in his fight for social and racial equality.

MORE:

Nike ad campaign:Kaepernick can take activism to all-world level

What took so long? Nike should have endorsed Kaepernick sooner

Take a stand:Kaepernick's new 'Just Do it' Nike ad puts pressure on NFL

There was risk of upsetting its partnership with the NFL and of potentially upsetting a portion of the NFL’s fan base that’s become turned off by player protests. Nike, which has a history of pushing boundaries in advertising campaigns, proceeded anyway.

Mark Parker, the chief executive of Nike, said on the company’s quarterly earnings call that embracing Kaepernick has led to “record engagement with the brand.”

“We feel actually very good and are very proud of the work we’ve been doing,” Parker said. “We know it’s resonated actually quite strongly with consumers.”

Follow Michael Singer on Twitter @msinger.