James Grant strolled through the Walt Whitman Houses in Fort Greene, Brooklyn, recalling his past as a drug dealer while pointing out where he played football and where the police caught him with a Tec-9 pistol after a foot chase. Now, he said, he is planning on acting lessons and a life with fewer burdens than being a leader of the Bloods gang.  Mr. Grant, 30, brought his experience to bear as the lead of the movie “Five Star,” which ends a limited run in New York on Thursday and opens in Los Angeles on Friday. He plays Primo, a Bloods general operating inside the Whitman public housing complex.  “I’ve done things I’m not proud of,” Mr. Grant said recently while sitting inside Fort Greene Park, next to the Whitman houses. “I’ve been violent. I’ve been an enforcer.”  Although he said he maintains a connection with Bloods, whom he said he joined at the age of 12, Mr. Grant said he has renounced crime and has not been arrested since being released from jail in 2008. Still, his familiarity with gang life and drug trafficking provided a well of knowledge that informed his acting (he has had no training, and Primo is his first role) and furnished the director, Keith Miller, with details that added authenticity to “Five Star,” which describes the relationship between Primo and a young man named John (John Diaz), whom he invites to join the Bloods.  Elements of Mr. Grant’s life echo throughout the film, which was shot mainly in the Whitman houses, where he once lived, and in the home in Newark where he lives now. One scene, in which Primo works as a bouncer, was filmed at a bar in Fort Greene where Mr. Grant once had a job checking IDs. People he knows from the Whitman houses appear in the film, portraying dealers or acquaintances. His girlfriend, two children and two stepchildren also make appearances, as Primo’s family.  The movie opens with an autobiographical three and a half minute monologue from Mr. Grant as Primo, who haltingly reveals that he missed the birth of his son because he was in jail. He describes holding the infant for the first time and says: “On that day I promised my kid, I swore to him, I swore to my son and I swore to my daughter, ‘I’ll never leave you again.’ ”  Mr. Grant said that missing the birth of his son, Sincere, prompted him to turn away from crime.  “It hits home when you’re not there to provide for your children,” he said. “Some things in me just had to change.” Primo is depicted as coming to a similar realization, immersed in gang life but yearning for a safer, more stable existence. He is ruthless with other dealers but tender while caring for an autistic son and paternal at times with John, whose father was a Bloods leader before he was fatally shot.  Mr. Miller said that he began with an idea for a film that would address the problems and responsibilities of being a man. He was introduced to Mr. Grant at the Whitman houses in 2011 by Shannon Harper, the lead in his first movie, “Welcome to Pine Hill.”  Soon afterward, he asked Mr. Grant to be in “Five Star.” Mr. Miller wrote the script but added details from Mr. Grant about gangs and the motives of Primo, who in one scene assaults a dealer who owes him money.  “You’ve elevated through the ranks and put in enough time and enough work to be recognized as the boss, to be recognized as somebody of supreme power, supreme authority, of supreme knowledge,” Mr. Grant said, explaining why a Bloods leader would batter someone over a drug debt, adding, “In that lifestyle you cannot allow any disrespect.”  It is difficult to pinpoint the influence of the Bloods within the Whitman houses during the time that Mr. Grant was active there, between 2006 and 2010. Prosecutors with the Brooklyn district attorney’s office said the Bloods did not appear to have been prominent in Fort Greene at that time. Officials with the Federal Bureau of Investigation, which monitors gangs, declined to comment on Bloods activities in the neighborhood then, citing “operational concerns.”  It is clear, however, that the Whitman houses were sometimes the setting of lawlessness and violence around the time that Mr. Grant was there. In 2007, masked assailants fatally shot a young man at the complex. Later that year, a police sergeant killed a gunman during an outdoor exchange of fire. In 2008, members of the FDP Crew, a gang that operated in the Whitman houses, pleaded guilty to federal charges including racketeering, conspiracy to distribute narcotics and the use of a firearm.  As a member of the Bloods in Fort Greene, Mr. Grant said, he committed crimes, survived a serious stabbing and was arrested on a gun possession charge that was later dismissed. Based upon a birth date he provided, the Brooklyn district attorney’s office said it knew of no convictions for Mr. Grant. He was arrested in Jersey City in 2007 on robbery and assault charges, he said, and eventually pleaded guilty to theft.  Some parts of the film were tightly directed, with Mr. Miller insisting on precise dialogue. But more often he took a looser approach. He distributed scenes only a day in advance so that performances would feel fresh rather than rehearsed, allowed actors to use their own language and looked for unscripted moments that could enrich the narrative.  One came when Sincere, who is autistic, interrupted a filming sequence in Newark. Mr. Miller kept the cameras rolling as Mr. Grant spoke with his son, then mused aloud about the boy, saying that he saw him not as flawed but perfect. Mr. Miller said that he had told Mr. Grant that he had to show vulnerability in the film as well as toughness.  He proved capable of both, Mr. Miller said, calling Mr. Grant “a generous actor” who was “very reflective, very collaborative.”  During his stroll around the Whitman houses, Mr. Grant was recognized by residents and workers. A man hugged him and urged him to set a good example for younger people. Another invited him to a youth day run by a church. Mr. Grant said he would go, adding a moment later that it was gratifying to be greeted with affection in a place where he once had to watch his back.  “Fort Greene is a beautiful place,” he said. “But it also feels good to know I left, that I had the opportunity to leave, because if you stay somewhere you don’t grow.”  A version of this article appears in print on July 30, 2015, on page C1 of the New York edition with the headline: Enforcer on Screen, if No Longer One in Life . Order Reprints| Today's Paper|Subscribe
The actor survived life in the drug trade in the Whitman public housing complex in Brooklyn before getting a leading movie role.