Michael Ricigliano Jr. didn’t always dream of being a writer. He grew up in Garden City, attended Hofstra University and became a real estate attorney. But around the time he turned 40, something inside him clicked.

“I had an idea for a film and thought — why not?” he says.

So Ricigliano — now 45, married and raising three children in Locust Valley — started reading books on how to write screenplays. “I just started writing and writing, down in the basement after my kids went to sleep.” His first short film won several film festival awards in 2011, so he continued writing. The dedication paid off.

“The Brooklyn Banker,” Ricigliano’s first feature-length screenplay, hits movie theaters Aug. 5 in a limited release across the country, including Long Island. The independent film, about a Brooklyn family man (Troy Garity) with a savant’s knack for numbers and a goofball uncle (Paul Sorvino) who gets them ensnared in a scheme laundering money for the mob, is executive-produced by Ricigliano and directed by Federico Castelluccio (who played Italian mobster Furio on “The Sopranos”).

Following the dictum “Write what you know,” Ricigliano did, setting the story in Williamsburg in the 1970s, inspired by tales of the old neighborhood told by his dad, who grew up there. Most of the film was shot on location in 2014 — look, there’s Bamonte’s Restaurant (“the food is still fantastic there,” Ricigliano says) and the old Our Lady of Mount Carmel church.

“We wouldn’t be able to shoot there today,” he says, noting the furious pace of gentrification. “We could only shoot the church from one direction, because of all the new high-rises.”

advertisement | advertise on newsday

Filmmaking has its challenges, but Ricigliano’s hooked. He’s formed a production company and has written several other film and television scripts he hopes to produce, plus a play that debuted Off-Broadway last year.

And what does his wife think?

“Well . . . ,” he starts, and there’s a long pause. “As long as the bills are paid, everybody’s happy,” he says, chuckling.

He still practices law but will continue writing.

“I didn’t want to be the guy who’s 80, saying, ‘I had a great idea once,’ ” he says. “I realized I was in a position where I could do it — I had the time, the kids were young enough. So . . . I gave it a shot. It’s been a great ride.”