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

A New Mexico man who had been described as a "commander" of a group accused of detaining migrants was sentenced to nearly two years in prison Wednesday for illegally possessing guns, prosecutors said.

Larry Mitchell Hopkins, 70, was sentenced to 21 months for being a felon in possession of a firearm, the U.S. Attorney's Office for the District of New Mexico said in a statement.

Hopkins pleaded guilty in January under a plea agreement and admitted to having possessed nine pistols, rifles and shotguns on Nov. 28, 2017, in San Juan County, the U.S. attorney's office said.

Hopkins is barred from owning guns because of previous convictions in Michigan, Oregon and South Dakota.

Download the NBC News app for breaking news and politics

Hopkins was arrested in April 2019. His arrest occurred after Gov. Michelle Lujan Grisham, a Democrat, demanded that members of a militia group, some of whom were armed, stop detaining migrants at the New Mexico-Mexico border.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

At the time of Hopkins' arrest, Jim Benvie, a spokesman for United Constitutional Patriots, said Hopkins was the group's "national commander."

The group had been accused by the American Civil Liberties Union of New Mexico of capturing nearly 300 people near Sunland Park, a city about 10 miles from El Paso, Texas.

The 21-month sentence imposed Wednesday was the term sought by federal prosecutors, according to court documents.

Prosecutors said in a sentencing memorandum that Hopkins, along with others, formed an armed militia that "engaged in vigilante-tactics by detaining immigrants without any legal authority to do so."

Hopkins' attorney, Kelly O'Connell, said Thursday that Hopkins was disappointed that he would not be sentenced to time served, but he said that the plea deal was a good one that avoided more serious prison time, and that the possession of a firearm charge would be an easy one to prove.

Larry Mitchell Hopkins in a law enforcement photo. Dona Ana County Detention Center

O'Connell noted in the defense's sentencing memorandum that Hopkins was never charged with a crime in Sunland Park. The attorney suggested that he was charged because of media and state attention about the group's activities.

Hopkins "sees the error of his ways" and has renounced any more border or militia activities, according to the defense document. His jailing and prosecution have "already inhibited other patriot border groups," O'Connell wrote.

O'Connell also wrote that Hopkins is obese and in poor health, and cited concerns that if he gets the coronavirus illness, COVID-19, in prison he could die. O'Connell said that with the time Hopkins already has already served, he faces around 9 months in prison.

Hopkins had previously been convicted in three states of criminal impersonation of a peace officer, gun possession and federal charges of failure to pay child support, which barred him from owning guns, prosecutors said.

CORRECTION (April 16, 2020, 5:15 p.m. ET): A previous version of this article used the incorrect pronoun "she" for Hopkins' attorney, Kelly O'Connell. O'Connell is a man.