The police found two other Algerian men they were seeking — a 31-year-old in Berlin and a 26-year-old in Hanover — but did not take them formally into custody, the authorities said.

All four men are suspected of links to the Islamic State, also known as ISIS or ISIL, and are believed to have been “planning a violent act intended to seriously damage the state,” Mr. Redlich said.

The raids involved 450 police officers, Mr. Redlich said. In Berlin they were centered on four apartments and two businesses; in Attendorn and Hanover the investigation focused on refugee shelters.

The police in North Rhine-Westphalia disclosed last month that a man who had most recently lived at a refugee shelter in the town of Recklinghausen was the lone assailant who was shot and killed in January as he approached a Paris police station on the anniversary of the assault in January 2015 on the French satirical newspaper Charlie Hebdo.