One student exchanged hand gestures with a classmate in the school hallway. Another drew graffiti in his notebook. A third wore a Chicago Bulls T-shirt.

School authorities on Long Island, New York, accused the teenagers of displaying signs or symbols associated with a notorious street gang with close ties to Central America. They were suspended, and several of the students were arrested. But before the charges were substantiated – even before appeals of their suspensions were complete – the students were shipped off to detention facilities thousands of miles from home, without their parents’ knowledge.

Not because of gang activity – which has yet to be proven in court – but because of immigration status.

How teenagers with no criminal convictions ended up in the hands of federal authorities is the subject of a lawsuit filed by the American Civil Liberties Union (ACLU). It’s also a troubling example of how Donald Trump’s wide ranging executive order to ramp up immigration enforcement may be giving federal immigration authorities a stronger foothold in America’s schools.

As many as 20,000 police officers are stationed inside American schools to help maintain safety. Called school resource officers, they are employed by local police or sheriff’s agencies and historically have few ties to immigration authorities. But Trump’s immigration order, signed in January, revived a decades-old program which trains local law enforcement officials in immigration enforcement and deputizes them with federal authority. Since some of these newly empowered police departments also deploy officers to schools, attorneys and civil rights activists say school resource officers can easily become a conduit for personal information about students and their families, such as undocumented status, that is supposed to be protected under federal student privacy laws.

Immigration arrests have increased 38% since Trump took office. Though just 60 law enforcement agencies currently participate in the immigration enforcement program, according to Ice, that number has nearly doubled since January. Interviews with officials at participating local agencies show that about half assign officers to schools, including in Maryland, Arizona and South Carolina.

A 2011 Ice memo discouraging enforcement at schools remains in place under Trump, spokeswoman Jennifer Elzea said. A supreme court decision from 1982 established that all children living in America have the legal right to attend public schools, regardless of their immigration status. The department of homeland security is “committed to ensuring that people seeking to participate in activities or utilize services provided at any sensitive location are free to do so without fear or hesitation”, she said – but immigration authorities “will no longer exempt classes or categories of removable aliens from potential enforcement”.

On Long Island, where police are battling the brutal street gang MS-13 – an effort applauded by Trump in a visit last month – attorney Bryan Johnson said that innocent teenagers at Brentwood high school have been swept up after educators shared student disciplinary records with school resource officers from the Suffolk County police department, which has a partnership with federal officials to crack down on gang violence. Schools, he said, “can have a pretty strong educated guess” as to a family’s immigration status, and because the schools provide the information, immigration officials know where students live. More than 75% of students at the high school are Hispanic.

In July, Trump spoke about a US government crackdown on the gang MS-13 in Brentwood, New York. Photograph: Jonathan Ernst/Reuters

Felix Adeyeye, a spokesman for Brentwood Union Free School District, said “it’s preposterous” to think educators share student records with school resource officers. Suffolk County doesn’t have a federal immigration enforcement agreement, but attorneys pointed to other avenues for cooperation, including a gang task force and informal deals.

Suffolk County police commissioner Timothy Sini told WNYC “there are a number of ways” school suspensions can reach immigration officials. “And kudos to school resource officers for being diligent,” he said. Sini did not respond to requests for comment.

In its lawsuit, the ACLU of Northern California accused the Trump administration of using “unsubstantiated claims of gang affiliation” to send three Suffolk County minors to detention in California.

Brentwood is just one of dozens of districts nationwide where immigration enforcement in schools, or fear of it, has terrified immigrant students; about 1 million undocumented children live in the US, and an estimated 5.5 million kids have at least one undocumented parent. Across the country, districts have adopted “sanctuary school” resolutions to help students feel safe – not from gangs, but from immigration agents.

Dani Moore, an immigrant rights activist in North Carolina, said the dual role of the Wake County sheriff’s office, which collaborates with immigration authorities, raises questions. “We’re concerned about instituting a show-me-your-papers mentality among law enforcement officers on the streets, in our neighborhoods, outside of our schools, and even inside our schools,” Moore said.

Immigrants take a workshop on dealing immigration officials at a Academia Avance, a Los Angeles charter school. Photograph: David Mcnew/AFP/Getty Images

Many school districts are not taking chances. In June, Wake County’s school board clarified a policy that grants school police special access to campus to conduct school-related duties, school board member James Martin said in an email. But when acting in any other capacity, including immigration enforcement, they need a subpoena or warrant.

Wake County sheriff Donnie Harrison couldn’t be reached for comment but told the News and Observer the revision was unnecessary because deputies inquire about immigration status only of people in jail, adding that school board members “don’t tell my deputies what to do. They work for me.”

Beyond federal agreements between police and federal agencies, many city agencies and immigration authorities already have a history of collaboration, said Harold Jordan, a senior policy advocate at the ACLU of Pennsylvania. In fact, a majority offer informal, voluntary assistance, according to a December survey by the Immigrant Legal Resource Center.

In testimony before the Senate committee on homeland security and governmental affairs, Sini said combatting MS-13 requires “a particular focus on the unaccompanied alien children population”.