Mr. Segovia-Benitez repeatedly ran into legal trouble over the years. His felony convictions included assault with a deadly weapon, false imprisonment and narcotics possession, and he was sentenced to eight years in prison for corporal injury to a spouse.

Mr. Petty said that people with traumatic brain injuries are more likely to act erratically.

Carlos Luna, the president of Green Card Veterans, an organization that works on behalf of veterans who are at risk of deportation or under removal orders, said on Thursday: “The communities where these men and women come from are overpoliced. They are judged more harshly than other Americans.”

He added, “Veterans are no exception to any of these. In fact, we see an increased rate of veterans within our justice system.”

There is little data on how often veterans are deported, Mr. Luna said. The United States Government Accountability Office released a report in June that said ICE had developed policies for handling cases of veterans who are not citizens and may face deportation, but the agency does not consistently adhere to those policies and it does not consistently track the veterans.

Mr. Segovia-Benitez was ordered deported on Oct. 10, 2018, and he appealed his case with the Board of Immigration Appeals, which was denied, ICE said. He also filed two stay requests with the United States Court of Appeals for the Ninth Circuit, and those requests were also denied, according to the agency.

Mr. Segovia-Benitez had nearly been deported on Oct. 16 of this year, according to Mr. Petty. He was pulled off a plane bound for El Salvador after his lawyer contacted ICE arguing that his immigration case should be reopened. Mr. Segovia-Benitez was sent to the ICE facility in Arizona, where he was held until Wednesday.

Mr. Segovia-Benitez’s deportation was reported Wednesday by The Orange County Register, which had covered his case extensively.