The Trump administration's decision to add a question about citizenship to the 2020 US Census set off threats of a lawsuit from Massachusetts Attorney General Maura Healey and caused the state's elections chief to accuse federal officials of attempting to "sabotage" the census.

Bill Galvin, the elections chief who also serves as the US Census' liaison in Massachusetts, called the question "completely irrelevant" to the federal process.

"This is nothing but a blatant attempt by the Trump Administration to frighten minority groups away from being counted and to sabotage the 2020 Census," Galvin said in a statement.

But Massachusetts state law has long required cities and towns to ask residents for their nationality if they're not US citizens, as part of a local census, also known as a resident listing, Galvin's office acknowledges.

The origins of the state requirement are unclear, but it's something that concerns advocates who say asking a citizenship question in any context is "inappropriate."

For example, in Boston officials are calling on people to fill out the "Annual Resident Census," noting that the city is "required by law to conduct a census of all residents 17 years of age or older."

A flyer handed out by the Boston Elections Department adds, "The information collected is used to protect your voting rights and provide better City services."

The paper form mailed out to residents asks adults to list whether they're a citizen, voter, or veteran. And on the city of Boston's official website, answering the citizenship question is mandatory when filling out the form.

"Every resident of Boston matters and it is important every resident be counted!" the Boston Elections Department flyer says.

Boston Mayor Marty Walsh's office referred questions about the city census to Galvin.

A spokeswoman for Galvin's office said the city census is "merely an information gathering tool" used for voter rolls and jury lists, things the federal census don't have anything to do with.

The results of not responding to the federal census and city census also vary, Debra O'Malley, the Galvin spokeswoman, added. If you don't respond to the city census, you're given inactive voter status or you're omitted from the jury pool, and you need to be a US citizen to participate in either activity anyway.

"The results of someone not being included in the federal census include less representation in Congress, less representation in the Electoral College, and less financial support from the federal government in communities that are often the most vulnerable," she wrote.

But Oren Nimni, an attorney for the Lawyers' Committee for Civil Rights and Economic Justice, said for someone having to answer the citizenship question on the federal census and the city census, "it is kind of a distinction without a difference."

"We believe that asking citizenship questions on a census is inappropriate in any context," he told MassLive.

The citizenship question on the federal census has more of an impact, since it reaches more people and there are increased fears that the data could be used for immigration enforcement, he said.

But as far as the "chilling effect" those questions could have on immigrants, his group advises states and cities to take a "hard look" at their own citizenship question policies and recommends they should be abandoned. States already have access to much of the immigration data through federal sources, Nimni added, and any need for the information is outweighed by the "chilling effect" brought about by asking the question.

Healey's office said they're challenging the Trump administration's addition of the citizenship question because it hinders the constitutional purpose of the federal census, which is to provide an accurate count of the entire population.

"We believe it is important that similar processes in Massachusetts take proactive steps to ensure full participation and accuracy," a Healey spokeswoman said in a statement.