A new civil rights lawsuit filed Tuesday in Boston's federal court says Bristol County Sheriff Thomas Hodgson detained an immigrant based solely on the man's immigration status — which is illegal under current law.

The complaint also charges that Hodgson has encouraged and condoned his employees detaining immigrants without the clear legal authority to do so.

The Lawyers' Committee for Civil Rights and Economic Justice and Latham & Watkins LLP filed the suit on behalf of 38-year-old Moises Rivas, who is originally from El Salvador but who, according to his attorneys, has been living in New Bedford for many years.

Rivas was serving time at the Bristol County Jail on Ash Street in New Bedford for a "minor non-violent charge," according to a press release, when his family attempted to pay his $1,000 bail. They were told that Rivas could not be released on bail because of his immigration status and that the Bristol County Sheriff's Office would continue holding him at the request of U.S. Immigration and Customs Enforcement (ICE).

The suit says Rivas' imprisonment, which lasted from Aug. 18 to Sept. 5, 2017, was based solely on his immigration status and therefore was in direct violation of the July 2017 Supreme Judicial Court ruling in Commonwealth v. Lunn. The SJC ruled that state officials do not have the power to detain people on civil immigration matters alone.

“The allegations made by the Lawyers’ Committee for Civil Rights and Economic Justice in a complaint filed against myself and others from Bristol County are completely false, unethical and a clear attempt by a an illegal immigration advocacy group to make a political statement,” Hodgson said in a statement released Tuesday afternoon.

In the statement, Hodgson refuted the allegations in the lawsuit, writing that Rivas was “never held on an ICE detainer, but rather was held by a judge in the New Bedford District on bail pending trial for Domestic Assault and Battery, a violent crime.” He said that the sole request made by ICE regarding Rivas’ incarceration was that the federal agency receive a phone call notifying them if Rivas was released on bail.

Three clerk magistrates “refused” to bail Rivas, according to Hodgson’s statement, “apparently believing ICE would arrest him” before a fourth clerk magistrate granted him bail.” The statement goes on to say that “no one at the Sheriff’s Office ever told him or anyone he could not be released due to ICE paperwork.”

Hodgson and the Bristol County Sheriff's Office have argued within the last few months that their partnership in the federal 287(g) program precludes them from the Lunn decision, "because we are certified ICE representatives — our officers are, who have gone through the four-week training," Hodgson said.

"Mr. Rivas was stripped of his liberty and kept in jail because he is an immigrant,” Oren Nimni, Civil Rights Fellow at the Lawyers' Committee, said in a statement. “That offends fundamental constitutional protections under both federal and state law.”

The lawsuit also says Hodgson has made public comments that "indicat[e] animus towards immigrant communities" and cites his January 2017 announcement offering Bristol County inmates to help build President Trump's proposed border wall. In addition to seeking damages for Rivas, the suit asks the federal court for a decision "prohibiting the Bristol County Sheriff’s Office and its employees from unlawfully detaining individuals solely on the basis of an ICE Detainer."

“This lawsuit is yet another attempt to paint those committed to obeying the law and keeping the community safe with the brush of bigotry,” Hodgson said in his statement. “Its purpose is propaganda intended only to try and convince an already frightened community that a commitment to observance of the law and safety in the cities is driven by racial animus.”