More than 450 officers took part in the mass raids targeting 12 locations, mostly in the central city of Goettingen in Lower Saxony state, they said.
Police investigating the fundamentalist Islamist community had acted on information pointing to "a possibly imminent terrorist attack", said the city's police chief Uwe Luehrig.
They detained the two men, a 27-year-old Algerian and a Nigerian, 23, who had both lived for some time in the city with their families.
Germany was hit by several attacks last year claimed by the Islamic State group -- the most deadly of them a December 19 truck rampage though a Berlin Christmas market that claimed 12 lives.
German federal prosecutors, in charge of terrorism cases, have struggled with a flood of investigations against suspects and returned fighters from Syria and Iraq, news magazine Der Spiegel reported last weekend.
Chief prosecutor Peter Frank urgently requested personnel support from Germany's 16 regional state services, complaining in a letter that his national-level service had "reached the limit" of what it could do, the magazine reported.
Disclaimer: No Business Standard Journalist was involved in creation of this content
