Terence Winter came of age in New York City during the bad old days of the 1970s and early 1980s.

The “Boardwalk Empire” creator/showrunner remembers a time when areas of Manhattan such as the Upper East Side and Meatpacking District were a “no-man’s land.” By the time he left for Los Angeles to take a flier at being a TV and film writer, he was convinced that New York City would never be revitalized to the degree it is today.

He’s glad to have been wrong. Now he’s happily raising his two young children in Gotham with his wife, “Dallas Buyers Club” producer Rachel Winter.

SEE ALSO: Terence Winter and the ‘Boardwalk Empire’ Team on the Mob Men’s Last Call

“It started with the simplest thing — the police cracking down on people who were throwing trash everywhere,” Winter said. The prevalence of trash “was a psychological thing that told people that the basic rules of society didn’t apply here. Once people saw that this was not being tolerated any more, it became easier to enforce a sense of order.”

Like Al Capone, Winter grew up in Brooklyn, not far from Steiner Studios where “Boardwalk” is based. Steiner is also home for Winter’s next HBO project, a drama set in the 1970s New York music scene.

Winter was a late bloomer as a scribe. He attended a vocational high school in Brooklyn, where he studied to be an auto mechanic. He bounced around after graduation with various pursuits — for a time, he was a partner in a delicatessen — until one day in Greenwich Village, he stumbled onto the campus of NYU.

SEE ALSO: New York City is a Key Plank for ‘Boardwalk Empire’s’ Attention to Detail

Winter was advised he’d have a better chance of getting into NYU if he chose an esoteric major — so Medieval History it was. He didn’t stay in the Middle Ages for long, however. He eventually earned a law degree, with the goal of becoming a prosecutor. But he wound up working for a corporate law firm, a job in which he was miserable.

So at 29, he packed up his possessions and headed out to Los Angeles to become a screenwriter. He’d always been a big movie and TV fan, but otherwise had no idea how to break into the biz.

“People thought I had lost my mind,” Winter recalled. He says he “lived like a monk” and wrote all day and night, eventually landing a slot in the Warner Bros.’ writers’ workshop program that helped open some doors for him on such notable productions as the syndicated revival of “Flipper” and “Xena: Warrior Princess.”

His corporate law background led him to a staff job on the Fox legal drama “The Great Defender,” which was run by future “Sopranos” scribe Frank Renzulli. The show lasted eight episodes, but the connection with Renzulli helped Winter secure what would be his career-making job on “The Sopranos.”

HBO brought to Winter the nonfiction book that inspired “Boardwalk” not long after “Sopranos” ended in 2007, with Martin Scorsese already attached. Saying “yes” was a no-brainer to Winter: He had always had a fascination with the era and its characters. “1920 was such a time of change for the country in every way,” said the exec producer. “For the show, it was a great chance to meet these guys — Al Capone, Lucky Luciano, Meyer Lansky — as kids, and see how they started.”

Once the project was on its way to series, Winter recruited a playwright, Howard Korder, whose work he admired, to help him blend fact and fiction to flesh out the world of Nucky Thompson. Korder initially said no — his only TV experience had been an unpleasant stint on the 1980s sitcom “Kate & Allie.”

“I asked him to give me two months, and I promised him it wouldn’t be anything like (that),” Winter said. The two quickly fell into an easy groove of working together. Winter credits Korder with brainstorming the character of Richard Harrow, played by Jack Huston, and many other great moments of the series.

The other pleading phone call Winter made early on was to “Sopranos” alum Tim Van Patten, who had directed most of the episodes Winter wrote for that series.

“Aesthetically, he has the most incredible visual palette in his head,” Winter said. “Actors adore him, crews adore him. I knew if anybody could follow Martin Scorsese after the pilot, it would be Timmy.”

Winter, Korder and Van Patten have been the creative pillars of “Boardwalk,” though Scorsese has remained active in reading scripts and weighing in on casting decisions. Winter and Scorsese’s partnership has since expanded to “The Wolf of Wall Street,” which nabbed Winter an Oscar nom for adapted screenplay this year, and the HBO rock ’n’ roll drama, which recently wrapped lensing on its pilot.

With “Boardwalk” concluding its five-season run Oct. 26 with finale, “Eldorado” (written by Korder and Winter, and helmed by Van Patten), Winter sounds wistful to be saying goodbye to Nucky, Eli, Margaret, Chalky and the rest of the gang(s), and the cast and crew who brought them to life.

But as Prohibition ends, so does the tale for “Boardwalk’s” rogue’s gallery. “We’ve reached a natural ending point,” Winter said. “I can’t believe how lucky I’ve been to have done this show with all of these great people.”