An outspoken immigration lawyer from North Andover who actively warns immigrants about their rights on a popular Instagram account alleges that federal agents surrounded him at Boston Logan International Airport and seized his phone without reason, according to a complaint filed in federal court.

Andrew G. Lattarulo, a US citizen who regularly calls out the Trump administration and what he calls ICE’s illegal tactics, alleges that federal agents were lying in wait for him when he arrived from Aruba on Sept. 28 and were solely focused on his cell phone, the 16-page lawsuit said.

Lattarulo, whose law office is in Chelsea, says his phone contains confidential information given to him by thousands of clients who have pending cases before the immigration courts. His lawsuit alleges irreparable harm if federal agents do not return his phone and destroy any information they accessed on it.

A spokesperson for the Department of Homeland Security did not immediately respond to a request for comment.

Lattarulo declined to elaborate on the lawsuit in an interview. But his defense lawyers said in a statement that they believe he was targeted because he represents clients in immigration-related proceedings, and because “he has amplified the government’s own enforcement priorities via social media to immigrant communities and anyone else who might be interested.”

“Public criticism of our government is protected speech under the First Amendment,” the lawyers, Mary Lemay and Patrick Hanley of Butters Brazilian LLP, said in a statement. “We initiated this suit to protect not only attorney Lattarulo’s Constitutional rights, but also those of his clients.”

According to the complaint, the four uniformed agents who surrounded Lattarulo — three from US Customs and Border Patrol and one from the Department of Homeland Security — refused to identify themselves or specify why they were taking his phone, only saying that they were conducting a “federal inspection” and an ongoing border search.

The officer for the Department of Homeland Security told Lattarulo that “they would be taking his phone with or without his cooperation,” and agents “made it clear that it would be searched,” the lawsuit said.

Lattarulo, who has 22,000 followers as andyatlaw on Instagram, where he frequently posts videos in Portuguese that are critical of Trump and immigration agents, believes that he was targeted because of his public statements on US immigration policy, the complaint said.

Lattarulo’s suit alleges agents had no interest in anyone else on his flight, did not have a warrant, or any cause to suspect him of wrongdoing, did not search him or his luggage, and did not arrest him after taking his phone.

The encounter with federal agents played out at 7:15 p.m. in Terminal C at Logan, a domestic concourse. Lattarulo had pre-cleared the border when he left Aruba and was traveling with his brother, also an immigration lawyer, and a group of friends, according to court documents.

After agents took his phone, Lattarulo was given a detention notice and a custody receipt for his iPhone 15 Pro Max.

On Thursday, US District Judge Allison D. Burroughs ruled that she was “not in a position to order the return of the property.” Instead, she proposed that Lattarulo request a temporary restraining order, the return of his phone, and provide the defendants with notice of the lawsuit, along with information about the emergency relief he is seeking.

On Friday, the judge issued a temporary restraining order, preventing government agents from further searching the phone or transmitting any information they had collected from it. A status conference is scheduled for Tuesday.

Tonya Alanez can be reached at tonya.alanez@globe.com. Follow her @talanez.