BOSTON — A Massachusetts man who offered on social media to pay $500 to anyone who would kill a federal immigration officer was arrested Thursday, prosecutors said.

Law enforcement officials said they hope the arrest of Brandon Ziobrowski, 33, sends the message that they will not tolerate what they described as a rise in threats against immigration officers and others amid increasingly heated political debates.

“The agents and officers out there enforcing federal laws are doing their job, plain and simple,” U.S. Attorney Andrew Lelling told reporters. “Those who disagree with their mission are of course free to say so. But there is a difference between public debate and intentionally putting others in fear of their lives,” he said.

Ziobrowski, of Cambridge, is charged with using interstate and foreign commerce to transmit a threat to injure another person. He was arrested in New York, where he was visiting a friend. He is expected to make an appearance there Thursday before being transported back to Massachusetts.

It was not immediately clear if he has a lawyer. No number for him was listed in public directories.

Authorities say he tweeted last month to his more than 400 followers: “I am broke but will scrounge and literally give $500 to anyone who kills an ICE agent.” He also responded to a tweet about ICE officers putting their “lives on the line” to make arrests by saying, “Thank you ICE for putting your lives on the line and hopefully dying I guess so there’s less of you?” according to court documents.

Ziobrowski also tweeted about his desire to kill Arizona Sen. John McCain and said guns “should only be legal for shooting the police like the second amendment intended,” prosecutors say.

Twitter suspended his account after it was alerted to the threat about the ICE agents, according to court documents.

“People who try to politicize our mission are within the legal right to freedom of speech,” said Peter Fitzhugh, special agent in charge of Homeland Security Investigations in Boston. “But when freedom of speech crosses a line into threats or offers to have federal law enforcement officers killed, we will never tolerate that,” he said.