The U.S. Border Patrol is monitoring millions of American drivers nationwide in a secretive program to identify and detain individuals whose travel patterns it deems suspicious, according to an investigation. The program uses cameras to scan and record vehicle license plate information, flagging those deemed suspicious. Federal agents can potentially notify local law enforcement, the investigation found.

The Border Patrol has built a surveillance system stretching into the country’s interior that can monitor ordinary Americans’ daily actions and connections for anomalies instead of simply targeting wanted suspects. Started about a decade ago to fight illegal border-related activities and the trafficking of both drugs and people, it has expanded over the past five years. The Border Patrol has recently grown more powerful through collaborations with other agencies, drawing information from license plate readers nationwide run by the Drug Enforcement Administration, private companies, and local law enforcement programs funded through federal grants. Texas law enforcement agencies have asked Border Patrol to use facial recognition to identify drivers, documents show.

This active role beyond the borders is part of the quiet transformation of its parent agency, U.S. Customs and Border Protection, into something more akin to a domestic intelligence operation. Under the Trump administration’s heightened immigration enforcement efforts, CBP is now poised to get more than $2.7 billion to build out border surveillance systems such as the license plate reader program by layering in artificial intelligence and other emerging technologies. The result is a mass surveillance network with a particularly American focus: cars.

This investigation, based on interviews with eight former government officials with direct knowledge of the program who spoke on the condition of anonymity because they weren’t authorized to speak to the media, as well as dozens of federal, state and local officials, attorneys, and privacy experts, reveals how the program works on America’s roads. The investigation reviewed thousands of pages of court and government documents, state grant and law enforcement data, and arrest reports.

Courts have started to recognize that “large-scale surveillance technology that’s capturing everyone and everywhere at every time” might be unconstitutional under the Fourth Amendment, said Andrew Ferguson, a law professor at George Washington University. Nicole Ozer, the executive director of the Center for Constitutional Democracy at UC Law San Francisco, expressed alarm when told of the findings. “They are collecting mass amounts of information about who people are, where they go, what they do, and who they know,” she said. “These surveillance systems do not make communities safer.”