People would continue to be turned away at the German border, he said.
A Berlin administrative court said on Monday the expulsion of the three unnamed Somalis, who were sent back to Poland after arriving at a train station in eastern Germany, was "unlawful".
It said the asylum application should have been processed by Germany under the European Union's so-called Dublin rules that determine which country is responsible for processing a claim.
The ruling was a setback for Merz's government, which won a federal election in February after promising a crackdown on migration that has caused concern in neighbouring countries.
The court ruling has "possibly further restricted the scope for manoeuvre here," Merz told a local government congress. "But the scope is still there. We know that we can still reject people."
"We will, of course, do this within the framework of European law, but we will also do it to protect public safety and order in our country and to relieve the burden on cities and municipalities," he said.
Migration is among German voters' biggest concerns and a backlash against an influx of new arrivals has contributed to a rise in the popularity of the far-right Alternative for Germany party, which came second in February's election.
It is a big shift since Germany's "Refugees Welcome" culture during Europe's migrant crisis in 2015 under Merz's Conservative Predecessor, Angela Merkel.
Merz's government issued an order in May to reject undocumented migrants, including asylum seekers, at Germany's borders.
Monday's ruling was seized on by critics as evidence that Merz's migration policy was unworkable.
"The administrative court has determined that Dobrindt's policy of rejecting asylum seekers is unlawful, contrary to European law, and now the Federal Ministry of the Interior should really start thinking about how to finally put an end to this nonsense," Karl Kopp of the pro-immigration advocacy group Pro Asyl told Reuters.
Interior Minister Alexander Dobrindt defended the expulsions, saying he would provide the court with justifications for banning entry.
--Reuters--