Chris Noth’s latest role is so dark, he almost refused to play it.

“I just thought it was too ugly,” the actor said of the sinister defense attorney he plays in “White Girl,” which hits movie theaters Friday.

So what changed the 61-year-old’s mind? “You just can’t judge characters that way, because if you do, you’ll find yourself never working,” Noth explained, adding that in order to understand “evil” one must come to terms with the fact that such characters are human.

The film revolves around college-student Leah (“Homeland’s” Morgan Saylor) and her experience of moving to Ridgewood and exposure to sides of the city she had previously been sheltered from. While Noth may not have identified with his own character, the storyline resonated with the actor, who moved to Brooklyn in the ’70s at age 18, after growing up in Stamford, Connecticut.

“All I had was this great sense of freedom. ... You have that resilience when you’re young and you’re open to experience,” he said, recalling the roach-infested apartment across from the Brooklyn Botantic Gardens he shared with his then-girlfriend. “You’re open to danger, too. Some bad things can happen because you’re open to it. ... There is that recklessness that we all kind of go to because maybe we’ve been sheltered.

“New York is the greatest city in the world to lose yourself in,” he continued. “Because there’s all these other lost people too, and you’re a part of that. There’s that freedom.”

Fast-forward 40-odd years and Noth is one of the city’s most iconic New Yorkers — partly thanks to his roles in “Law & Order” and “Sex and the City,” but also because of his passion for the town.

Though he splits his time between here and LA, he still owns the same place on University and E. Ninth Street he’s had since ’92. “I live in a great neighborhood ... but [development has] just destroyed it. I didn’t come to New York to go to brand stores, to alleviate suburban people and create suburbia in the city, which is what’s happened.”

He finds authenticity from longtime haunts, like Knickerbocker’s by his home and Rao’s in East Harlem, where the actor is considering moving to.

“It’s more open,” he said. “And the boulevards and the buildings are beautiful.”