Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

The American Civil Liberties Union filed a federal lawsuit on Thursday against the U.S. Customs and Border Protection on behalf of two American women who were detained after speaking Spanish at a convenience store in Montana.

Ana Suda and Martha “Mimi” Hernandez, who were both born in the United States, have said they were detained by a Border Patrol agent after he heard them chatting in Spanish while buying groceries at a store in Havre, Montana, in May. Their exchange with him was captured by the women on video.

The agent, Paul O’Neal, “singled out, detained, and interrogated” the women “because he heard them speaking Spanish,” the lawsuit claims.

He “offered no other justification for their detention, and there was no reason to believe that either Ms. Suda or Ms. Hernandez had violated any law,” the suit says.

The ACLU also says in the complaint that the agent's actions violated the women’s rights to equal protection and their Fourth Amendment right against unreasonable search and seizure because there was “no legitimate reason to detain” them.

“Agent O’Neal singled them out based on race, relying on their use of Spanish as a justification and proxy for race,” the suit says.

The ACLU said in a statement that the incident was traumatizing and humiliating for the women, who despite living in Montana for years have since been “shunned and harassed by other town residents.”

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

“This changed our lives, I believe, forever,” Suda said, according to the statement. She has also said the incident has made her young daughter afraid to speak Spanish.

The lawsuit asks that the defendants — the CBP, its commissioner, the agent and others — be stopped from detaining individuals on the basis of race, accent or speaking Spanish, except for when when there are specific and reliable suspect descriptions.

The suit is also seeking compensatory damages.

Suda told NBC News shortly after the incident in May that O’Neal approached her and Hernandez after overhearing them speak Spanish while buying eggs and milk.

"He asked us where we were born, so I looked at him and I said, 'Are you serious?'" Suda said at the time. "He said, 'I'm very serious.'"

He then asked the women for their IDs, and the three went outside the store into the parking lot, where Suda began to record the incident on her cellphone.

A Border Patrol agent detained and questioned two U.S. citizens when he overheard them speaking Spanish at a gas station in Montana. Viral Hog

In the video, Suda is seen asking the agent why he was asking the women for their identification.

"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," the agent, who identified himself as Agent O'Neal, said in the video.

When Suda asked if she and her friend were being racially profiled, the agent responded no.

"It has nothing to do with that," he said. "It's the fact that it has to do with you guys speaking Spanish in the store, in a state where it's predominantly English-speaking."

Suda said that the agent took their IDs and kept them in the parking lot for about 35 to 40 minutes.

Suda was born in El Paso, Texas, and Hernandez was born in El Centro, California, according to the lawsuit.

The CBP said that as a matter of policy, it does not comment on pending litigation, but that “lack of comment should not be construed as agreement or stipulation with any of the allegations.”

In May, the CBP told NBC News in a statement the incident was being reviewed to make sure appropriate policies were followed. Agents have broader authority when operating within 100 miles of a U.S. border, such as by putting up checkpoints and questioning people in their vehicles about their citizenship — but CBP policy also says agents cannot stop or detain someone solely on their race or ethnicity.

Montana borders Canada.

Agents and officers "are committed to treating everyone with professionalism, dignity and respect while enforcing the laws of the United States," the spokesperson said at the time.