Federal immigration officials said they arrested two people Tuesday at Sonoma County Superior Court, a move that infuriated immigrant rights activists and local officials who said the action will have a chilling effect on undocumented communities coming forward when crimes are committed.

U.S. Immigration and Customs Enforcement, known as ICE, informed the county Sheriff’s Office around 7:45 a.m. Tuesday that federal agents would be present at the courthouse. By the time the court’s morning sessions were under way after 9 a.m., ICE had made its arrests, according to the office of county District Attorney Jill Ravitch.

The district attorney’s office said ICE arrested “at least three” individuals in and around the courthouse. But ICE on Wednesday said it arrested two people: Antonio Hernandez Lopez and Pedro Romero Aguirre, both undocumented immigrants from Mexico.

The arrests mark the latest episode in the standoff between federal immigration officials and local authorities that adhere to city, county and state sanctuary policies. Elected officials in Sonoma County and the Bay Area at large condemned Tuesday’s arrests, which they say put communities at risk by creating an environment where people fear going to court or cooperating with law enforcement.

“Public safety partners have worked with the immigrant community to foster trust. This action will impact that effort,” Ravitch’s office said in a statement Wednesday. “It is essential that victims and witnesses feel safe to report their experiences so that we can hold the guilty accountable.”

In a joint statement several officials released, Sonoma County Public Defender Kathleen Pozzi said, “ICE operations have no place in the court building.”

ICE defended the arrests Wednesday, arguing it has the legal authority to detain the men, who have criminal convictions and several previous encounters with immigration authorities, the agency said.

The agency condemned California’s sanctuary policies and vowed to continue arresting immigrants who are in the country illegally.

“Our officers will not have their hands tied by sanctuary rules when enforcing immigration laws to remove criminal aliens from our communities,” said David Jennings, head of ICE’s San Francisco office, in a statement Wednesday.

The agency also said local jusridictions that choose not to cooperate with ICE “are likely to see an increase in ICE enforcement activity” because immigration officials will conduct a larger number of enforcement operations.

Santa Rosa Police arrested Lopez on Dec. 24 on suspicion of inflicting corporal injury to a spouse, driving under the influence and preventing a witness from reporting a crime, ICE said. The charges are pending. He has a 2005 DUI conviction and was arrested by ICE officers four times between 2004 and 2007, according to ICE. At some point, Lopez voluntarily left for Mexico and returned.

Aguirre has five criminal convictions spanning more than a decade, ICE said, including misdemeanor trespassing, driving without a license, driving under the influence, illegal entry and misdemeanor battery. The agency arrested him six times in 2010 — he returned voluntarily to Mexico three of those times and was ordered removed the remaing three times, ICE said.

Both men are in deportation proceedings.

Defense attorney Martin Woods said a client of his was scheduled to enter a plea for a misdemeanor DUI and domestic violence case Tuesday morning but never made it inside the building. Instead, his client was arrested in the parking lot around 8:30 a.m. Woods did not disclose the name of his client.

“He was on his way to court,” Woods said. “I really don’t know exactly what happened.”

Woods said he told the judge, who continued the case to March and asked for verification of the arrest. Woods said he had not spoken to his client.

Court officials in San Francisco, San Mateo, Santa Clara, Solano, Napa and Contra Costa counties said they had not heard of similar arrests in their jurisdictions. Alameda and Marin counties court officials did not immediately respond to inquiries.

But concerns still mounted about the potential impact the arrests could introduce.

“We want to remind all of our residents that the city and county of San Francisco is a sanctuary city,” Mayor London Breed said in a video statement, which also featured Police Chief Bill Scott. “We will continue to do everything we can to support our immigrant communities.”

District Attorney Chesa Boudin also issued a statement slamming the arrests.

“ICE actions at courthouses undermine our ability to hold defendants accountable by deterring undocumented victims and witnesses from cooperating with the justice system,” he said. “These actions make all of us less safe.”

A spokesman for the Sonoma County Sheriff’s Office said the agency did not work with immigration officials on the arrests and it heard of the activity only when ICE called a dispatcher.

“The only thing that we are aware of is that they called in,” said Sgt. Juan Valencia, a Sheriff’s Office spokesman “They don’t work for us. ... It’s another law enforcement agency.”

Autumn Gonzalez, a volunteer with NorCal Resist, a local group that supports families targeted by immigration officials, said arrests like those made Tuesday deter people from seeking help from authorities — whether it’s obtaining restraining orders in domestic incidents or testifying in unrelated cases.

“It’s sincerely frustrating because it creates a very chilling situation,” she said. “It makes it very nerve wrecking for people to participate in the legal system.”

The arrests could affect all aspects of the judicial proceedings, Woods said, potentially resulting in defendants unwilling to go to courthouses and prosecutors who won’t be able to conclude cases because people won’t show up for their court appearances or to testify.

“It’s chaos,” Woods said. “Everybody at the courthouse is quite taken aback.”

Alejandro Serrano and Tatiana Sanchez are San Francisco Chronicle staff writers. Email: alejandro.serrano@sfchronicle.com; tatiana.sanchez@sfchronicle.com. Twitter: @serrano_alej; @tatianaysanchez.