This Jan. 23, 2019 photo released by ACLU of Montana, shows Martha “Mimi” Hernandez, left, and Ana Suda in Havre, Mont. Hernandez and Suda, both U.S. citizens, have settled their lawsuit with the U.S. Customs and Border Patrol. They were detained by an agent who said he was questioning them because they were speaking Spanish while standing in line at a convenience store. The women left Montana due to the community backlash after making the accusation, the ACLU of Montana said. (Brooke Swaney/ACLU of Montana via AP)

HELENA, Mont. (AP) — Two women who were detained in northern Montana by U.S. Customs and Border Protection agents for speaking Spanish while shopping at a convenience store have reached an undisclosed monetary settlement in their lawsuit against the agency, the ACLU of Montana announced Tuesday.

Ana Suda and Martha “Mimi” Hernandez, both U.S. citizens, said their constitutional rights were violated when they were detained in the parking lot outside a the store in the city of Havre for 40 minutes after an agent demanded their identifications.

In settling the case, U.S. Customs and Border Protection said it did not admit liability and added in a statement that “the overwhelming majority of CBP employees and officers perform their duties with honor and distinction, working tirelessly every day to keep our country safe.”

The case emerged after Suda took a video of the May 2018 interaction in which she asked Agent Paul O’Neill why he was questioning them.

“Ma’am, the reason I asked you for your ID is because I came in here and I saw that you guys are speaking Spanish, which is very unheard of up here,” O’Neill said in the video. Suda and Hernandez had valid Montana drivers licenses.

O’Neill, and a supervisor who arrived later made it clear through words and actions that the women were not free to leave the convenience store parking lot, ACLU attorney Alex Rate wrote in the lawsuit.

“We stood up to the government because speaking Spanish is not a reason to be racially profile and harassed,” Suda said in a statement provided by the ACLU. “I am proud to be bilingual, and I hope that as a result of this case CBP takes a hard look at its policies and practices. No one else should ever have to go through this again.”

U.S. Customs and Border Protection said in its statement that its workers “are trained to enforce U.S. laws uniformly and fairly and they do not discriminate based on religion, race, ethnicity or sexual orientation.”

It added that the settlement “is in no way intended to be, and should not be construed as, an admission of liability or fault on the part of the United States, its agents, servants, or employees, and it is specifically denied that they are liable to the plaintiffs.”

The agency did not respond to emailed questions asking if O’Neill still works for the agency or faced any discipline related to the case. The agency and the women’s lawyers did not disclose how much money would be paid in the settlement.

In gathering information for the lawsuit, the ACLU said Customs and Border Protection agents in northern Montana acknowledged they routinely profiled non-white people.

“It is a small place and we have a lot of agents here and nobody really has much to do,” an unnamed border protection supervisor told attorneys with the ACLU in a videotaped deposition.

He said he saw two people who appeared to be of Mexican descent at the mall while he was off duty, started reaching for his phone to call in what he saw but then spotted another border patrol agent behind them already talking on his phone.

“If there’s somebody speaking Spanish down there it’s like all of a sudden you’ve got five agents swarming in, ‘What’s going on?’ the supervisor said.

Suda and Hernandez faced backlash in Havre for bringing their complaint, the ACLU said.

“They both ultimately left Havre for fear of their families’ safety,” said Caitlin Borgmann, executive director of the ACLU of Montana.

Suda was born in Texas and moved to Montana with her husband in 2014. Hernandez was born in California and moved to Montana in 2010. Both are certified nursing assistants and worked at an assisted-living center.

Havre is a city of nearly 10,000 people in north-central Montana about 30 miles (48 kilometers) from the U.S.-Canada border and near two Native American reservations.

The city’s population is mostly white, about 15% Native American and about 4% Hispanic, according to the U.S. Census.