Customs and Border Protection agents set up an hours-long checkpoint on I-95 in Maine on Wednesday, arresting one man with an outstanding deportation order. In New Hampshire, Border Patrol stopped cars at checkpoint along the highway over the weekend. Five people were detained, reported New Hampshire Public Radio.

“If you want to continue down the road, then yes ma’am. We need to know what citizen — what country you’re a citizen of,” a Border Patrol agent said in a video, filmed by the Bangor Daily News.

These random checkpoints may seem like another symptom of Trump’s hardline immigration stance, but the Border Patrol has long had these powers.

Congress and the Supreme Court has given US Customs and Border Protection a lot of latitude to operate, and it can question almost anyone within 100 miles of any border — land or water — about their US status. That includes the right to establish immigration checkpoints to ask motorists about their citizenship.

Other videos of Border Patrol agents questioning people — including CBP agents checking citizenship on a bus in Florida, and an agent who stopped two women speaking Spanish in Montana last month as they were buying eggs and milk — have garnered outrage. Agents at bus stations in Maine have also come under fire, and the ACLU in Maine is suing the federal government for more information about these stops.

But what’s happening in Maine and New Hampshire are routine, and well within the legal authority of Customs and Border Protection, even though they come as the Trump administration’s immigration faces intense anger and scrutiny over family separations and its zero tolerance immigration enforcement at the border.

It’s legal for agents to ask a person about their citizenship status, with some exceptions

Congress gave immigration agents enormous power when they passed the Immigration and Nationality Act of 1946. The law granted immigration agents the authority “to interrogate any alien or person believed to be an alien as to his right to be or to remain in the United States” and to “board and search for aliens any vessel within the territorial waters of the United States and any railway car, aircraft, conveyance, or vehicle.” However, they could only do this “within a reasonable distance” from an external US boundary.

At first, that distance was just 25 miles. But in 1953, the Department of Justice published a rule redefining a reasonable distance to “a distance of not exceeding 100 air miles of any boundary of the United States.” In 2013, a group of senators tried to shrink the 100-mile zone to 25 miles along the northern border. The provision was added to a bipartisan immigration reform bill that passed the Senate that year, but a similar bill never made it through the House.

Over the years, the Supreme Court has upheld Border Patrol agents’ authority to stop and search people in the border zone, while also defining some limit to their powers. For example, the Court has ruled that agents must have probable cause to believe that someone committed an immigration violation to search their car in a border zone, but they only need a reasonable suspicion (a lower standard of proof) to stop and question them. If they establish a roadside checkpoint within the border zone, they can stop and question anyone who drives through about their immigration status.

Agents are even allowed to consider race as a factor in stopping someone, as long as that person’s race is not the sole reason for doing so.

In United States v. Brignoni-Ponce, a 1975 Supreme Court case, the Court ruled that it was a violation of the Fourth Amendment for Border Patrol agents to stop a car only because the driver looked Mexican. But while the Court agreed that “apparent Mexican ancestry” does not, on its own, justify reasonable suspicion that a person is undocumented, the justices did rule that it is a “relevant factor.”

To justify a stop, the Court said an agent needs several reasons to pull over a car near the border, such as observing a heavily loaded van or a car with an unusual number of passengers. That could also include “the characteristic appearance of persons who live in Mexico, relying on such factors as the mode of dress and haircut.” In other words, race can be part of the equation.

It’s hard to know how often these stops happen

The Department of Homeland Security doesn’t publish data on how many people agents stop and question in the border zone, only how many people they detain. In 2017, Border Patrol agents arrested 310,531 people at checkpoints and roving patrols across the country. This includes people apprehended trying to cross the border illegally.

Details of these arrests are scarce, and immigrant rights groups have repeatedly tried to get more information through Freedom of Information Act requests.

In 2012, Families for Freedom, a legal aid group for immigrants in New York, succeeded in suing the agency for records related to immigration arrests at bus and train stations in the state.

What they discovered was alarming: At one bus station in the Rochester area, Border Patrol agents mistakenly arrested 300 people with legal status from 2006 to 2010. That included immigrants with green cards and visitors with tourist visas. It also included 12 American citizens, according to a 2013 report from the group.

Border Patrol agents eventually released everyone who had legal status, but the practice has outraged civil liberties groups.

Lawyers for the American Civil Liberties Union have repeatedly criticized the 100-mile zone, saying that it subjects nearly two-thirds of the US population to Border Patrol’s “so-called investigatory detention and warrantless searches.”