New York Gov. Andrew Cuomo announced Wednesday the state would spend $18.5 million to fund programs designed to keep young people on Long Island from joining MS-13, a brutal gang tied to murders and violence in Nassau and Suffolk counties.

“Let’s stop the young people from getting caught in the gang pipeline to begin with, rather than just treating them as criminals once the gang takes over,” Mr. Cuomo, a Democrat, said at a news conference in Brentwood, N.Y. “Let’s not treat the disease, let’s prevent the disease.”

Gang violence on Long Island has drawn national attention, particularly because many MS-13 members are immigrants with roots in Central America.

Republican President Donald Trump, who visited Brentwood in July, vowed to arrest and deport gang members, saying they had turned some neighborhoods and parks into “blood-stained killing fields.”

On Wednesday, Mr. Cuomo said that although a law-enforcement response to the gang is important, a more nuanced approach is necessary to prevent local young people from being “easy prey” for gang recruiters.