Concepción Barrios and her husband, Margarito Silva, were arrested by immigration officials on July 4. (Courtesy of Perla Silva via GoFundMe.)

It was the Fourth of July, and longtime Brooklyn residents Margarito Silva, 60, and Concepción Barrios, 50, wanted to celebrate the holiday with their daughter and son-in-law, a sergeant in the Army.

Instead, while visiting the Fort Drum military base in Upstate New York, the parents were detained by Immigration and Customs Enforcement.

Silva and Barrios had visited several military bases in the past, in Brooklyn, Colorado and Hawaii, with no problems, their daughter Perla Silva wrote on Facebook during the weekend. While the husband and wife acknowledge living in the country illegally, they both have valid New York City-issued identification cards, which are available to New Yorkers regardless of immigration status.

During the couple’s previous visits to military bases, these ID cards were enough to gain entry, Perla Silva said. But during last week’s trip to Fort Drum, military authorities at the base stopped them.

Fort Drum Military Police called U.S. Border Patrol, which soon arrived to arrest the couple, a U.S. Customs and Border Protection spokesman said in a statement to The Washington Post.

Perla Silva was there with her 5-year-old daughter, who watched, weeping, as her grandparents were taken into ICE custody,

“Why was this time different from the other times we’ve visited them,” Silva wrote on Facebook. “Why on this 4th of July were they singled out?”

Army spokeswoman Julie Halpin told NBC New York that Fort Drum officials asked the couple for secondary identification because their New York ID cards do not have bar codes necessary to gain access to the base.

“The bar code brings us a photo of the individual that we can check against the ID and the person presenting it,” Halpin told NBC New York. “NYC IDs do not have this bar code.”

When Border Patrol agents arrived, Barrios and Silva admitted to and were charged with being illegally present in the country, the CBP spokesman said. They were transported for processing at the Wellesley Island Border Patrol Station and then taken to the Buffalo Federal Detention Center in Batavia to await their hearing before an immigration judge.

“Our family is devastated by what happened,” Perla Silva said in an emotional video statement shared on Twitter by New York immigrant advocacy group Make the Road. “We are most worried for my mother and my father who have serious health issues.”

The couple’s detention has drawn outcry from immigrant rights groups, political candidates and New York’s governor. It has also raised some fears that New York identification cards are providing undocumented immigrants with a false sense of protection from ICE — particularly on military bases.

New York City Mayor Bill de Blasio launched the IDNYC initiative in 2015, billing it as the largest municipal identification card program in the nation. To receive an IDNYC card, New Yorkers only had to present proof of identity, such as a foreign passport, and residency in New York City.

The program was intended to help undocumented immigrants, homeless people and others who may have trouble obtaining a government-issued ID. Cardholders can use the identification to access city services and buildings and to interact with the New York Police Department, which is not allowed to ask about immigration status.

But even in a state and city known for its “sanctuary policies,” these identification cards provide only limited protection. And as the New York Times wrote last month, the card can sometimes have the unintended consequence of flagging a person’s undocumented status.

“Once again, the IDNYC, the identification of New York City, was not enough for the guards of a military base in our area,” wrote a New York Telemundo affiliate.

In a similar instance just last month, a New York restaurant worker was detained by ICE after delivering pasta to Fort Hamilton, a small Army garrison in Brooklyn.

The Ecuadoran restaurant worker, Pablo Villavicencio, flashed his city ID card at the guard on duty, as he had done on several other occasions delivering orders there. But the guard said he needed a driver’s license. After a background check revealed an old ICE warrant against Villavicencio, military personnel called immigration officers, who arrested him.

A federal judge last month temporarily halted Villavicencio’s immediate removal to Ecuador, and on Friday, New York Governor Andrew M. Cuomo wrote an open letter to ICE demanding the immediate release of Villavicencio, who otherwise has no criminal record. “ICE’s treatment of Mr. Villavicencio is un-American and a blatant abuse of power,” Cuomo wrote.

Cuomo similarly condemned the detention of Barrios and Silva, saying the couple will be provided with a pro bono lawyer through the Liberty Defense Project “to combat this injustice.”

“Detaining a hardworking couple visiting their patriot son-in-law on the Fourth of July goes against everything this country stands for,” Cuomo wrote on Twitter Monday.

Gubernatorial candidate Cynthia Nixon, who has called for abolishing ICE, also spoke out about the detention. She told NBC New York that immediately upon taking office, she would aim to extend access to driver’s licenses for all undocumented New Yorkers.

“These are elderly Americans who have lived and worked in NY for two decades; whose family is in the military,” Nixon wrote on Twitter. “Yet when they try to visit their loved ones, they’re dragged hundreds of miles to an ICE detention center in Buffalo.”

Barrios and Silva have lived in New York for two decades, their son Eduardo Silva told NBC New York. They entered the country illegally, but in 2007 were approved for a Department of Labor work permit.

Their son-in-law is a sergeant in the 10th Mountain Division and has been deployed twice to Afghanistan, Perla Silva told NBC New York.

“He’s about to be deployed again while my sister is pregnant,” Perla Silva told the station. “He works so hard for his country, and he loves his country so much.”

Silva wrote in a GoFundMe account that her parents are both “very ill” and both just underwent surgery. They both take daily medications, and her mother had heart surgery two weeks ago, Silva wrote.

On Thursday, her mother called her crying, telling her a nurse would not allow her to take her daily heart medication, Perla Silva wrote. By Saturday, Perla Silva still had not been able to communicate with her father.

A CBP spokesman said both parents “had their medications with them and were allowed to take them when needed” during processing at the Border Patrol station. Their medications were stored in a refrigerator, as requested by the family, the spokesman said. Agents also met with family members of the detained couple during processing to receive a meal prepared for them “due to their medical condition.”

Still, relatives said they felt helpless as Barrios and Silva remained in ICE custody.

“I don’t know what’s going to happen in one day, in two days, in one month that they’re there,” one relative, Dulce Silva, told the Telemundo affiliate.

“We ask for all of the help possible to obtain answers of the injustice that occurred to my parents whom have never even had a ticket in their lives and ever since they came to this country all they’ve ever done is work,” Perla Silva wrote on the GoFundMe page.

Perla Silva’s Facebook profile picture showed her daughter next to her grandfather, Margarito Silva, “the only father my daughter has ever had.”

“Now my daughter is asking and asking when her daddy and grandma will come back,” Perla Silva wrote. “How do I explain it to her?”

More from Morning Mix:

A religious Oregon couple didn’t get medical care for their newborn. The child died — and now they’re going to prison.

Federal judge denies Trump administration’s request to indefinitely detain families

Tourists on honeymoon collide while zip-lining, leaving husband dead and wife injured