On their way home from working out at a gym last May, Ana Suda and Martha Hernandez, both U.S. citizens, stopped by a local convenience store in Montana to buy some milk and eggs.

A Border Patrol agent overheard the two friends speaking Spanish, and then demanded they show identification.

Now the American Civil Liberties Union has filed a lawsuit on their behalf, accusing Customs and Border Protection of violating the women's constitutional rights.

The encounter is not an isolated incident but part of a broader pattern of abusive behavior by Border Patrol agents who target people based on race, ethnicity or language, lawyers for the ACLU contend.

"The problem with that is that there are millions and millions of people who are Spanish speakers who are U.S. citizens or who are otherwise lawfully in the U.S., so knowing that somebody speaks Spanish doesn't tell you anything about whether they are or not undocumented, said Cody Wofsy, a lawyer with the American Civil Liberties Union Foundation, Immigrants' Rights Project in San Francisco. "That is exactly the kind of assumption that this case shows is problematic."

Suda and Hernandez were both born in the U.S., Suda in El Paso, Texas, and Hernandez in El Centro, California.

They grew up speaking Spanish and are fluent in English and Spanish.

Hernandez moved to Havre, Montana, in 2010, Suda in 2014. They work as certified nurse assistants at the Northern Montana Care Center in Havre, a town of about 10,000 people in north-central Montana near the Canadian border.

On May 16, according to the ACLU's lawsuit, Border Patrol agent Paul O'Neal overheard the two friends speaking Spanish inside a Town Pump convenience store in Havre. When the two women got in line to pay, the agent commented on Hernandez's accent and then asked the two women where they were born.

"Are you serious," Suda asked, according to the complaint.

"Dead serious," the agent replied, according to the complaint.

After Suda told the agent she was born in Texas and Hernandez said she was born in California, the agent demand they show him identification and refused to let them pay for their groceries until they did, the complaint states.

The two women handed the agent their Montana driver's licenses, the lawsuit states.

Women recorded agent with their phones

Outside, the two women began recording the agent with their cellphones.

"So can you tell us in the video please why you asked us for our IDs please," one of the women can be heard asking in the video released by the ACLU.

"Ma'am, the reason I asked you for your IDs is because I came in here I saw that you guys were speaking Spanish which is very unheard of up here," the agent answers politely and calmly in the video.

Later one of the women is heard asking the agent whether they had been racially profiled.

"No, it has nothing to do with that," the agent responds. "It has to do with the fact of you guys speaking Spanish in the store. ..."

"Spanish in the store?" the woman asks.

"Spanish in the store in a state where its predominantly English speaking, OK?" the agent responds.

Women detained for about 40 minutes

A second CBP officer arrived a short while later, followed by O'Neal's supervisor, according to the lawsuit.

The two women said they were detained approximately 40 minutes before O'Neal returned their driver's licenses and informed them they were free to leave, the lawsuit states.

The two women say they felt publicly humiliated by the experience and no longer feel comfortable speaking Spanish in public.

In the video, one of the women can be heard angrily chastising the Border Patrol agent.

"You don't have the right to stop me just because I speak Spanish, and you know that," the woman says.

Lawsuit says CBP agent violated rights

The lawsuit contends CBP agents violated the two women's Fourth Amendment rights against unreasonable search and seizure because their was no legitimate reason to seize them and because the agent singled them out based on race by relying on their use of Spanish as justification.

Havre has a growing Latino population, according to the Census Bureau.

With nearly 400 residents, Latinos make up about 3.9 percent of the town's population, according to the U.S. Census American Community Survey for the years 2013 to 2017.

The lawsuit contends that CBP agents from the Havre sector have targeted other Latinos without justification in the past, based on race.

The lawsuit also contends that two women detained by the Border Patrol agent at the convenience store last May were singled out three months earlier while out dancing at a bar.

An agent in plain clothes took pictures of them and sent the photos to other agents with the message, "There are two Mexicans at the bar," the lawsuit states.

The two women might have been detained had another agent, who received the message, not waved them off, saying that the two women were friends with his wife, the lawsuit states.

The lawsuit filed in U.S. District Court in Great Falls, Montana, asks a judge to order CBP to stop detaining people on the basis of race, accent or speaking Spanish unless the stop is based on "specific and reliable suspect description matching such characteristics."

The lawsuit also asks a judge to declare that race, accent and language cannot create suspicion sufficient to justify seizure or detention. It also asks for unspecified compensatory monetary damages.

The CBP said declined to comment to The Arizona Republic on the pending litigation.

More:No more speaking Spanish at the U.S. border? Customs and Border Protection agency says not to worry about it