Daimler, the owner of the Mercedes-Benz brand, was told to recall 238,000 vehicles in Germany.
“The government will order 238,000 Daimler vehicles to be immediately recalled Germany-wide because of unauthorised defeat devices,” the transport ministry said.
Germany can only order the recall of vehicles within its own borders, or of those vehicles issued with a pan-European road-worthiness certification via German authorities.
Mercedes-Benz C-Class, Vito and GLC models fitted with diesel engines were found to have issues, the ministry added. Daimler has pledged to work with authorities to remove the software.
Last week, Daimler’s chief executive Dieter Zetsche was summoned to answer questions by the ministry after Germany’s KBA motor vehicle authority said it found illegal software in one of its models.
Daimler is the latest automaker to be hauled before regulators after Volkswagen admitted to cheating diesel emission tests in 2015. Volkswagen’s bill for fines, fixing and replacing vehicles is almost $30bn ($23.4bn).
According to Spiegel magazine, German transport minister Andreas Scheuer threatened to fine Daimler 3.75bn euros (£3.3bn) over the scandal. The ministry can impose fines of up to 5,000 euros per car.
On Monday, Mr Zetsche said the company had found a solution to fix the software and did not expect a fine.
Daimler said it was cooperating with authorities and the legality of the software need to be clarified.