Ranbaxy said its US subsidiary would pay a $500m (£327m) fine, the biggest handed down to a generic drugmaker.
Ranbaxy USA pleaded guilty to improper manufacturing, storing and testing of drugs, closing a year-long civil and criminal investigation into the matter.
It also admitted lying about how it tested drugs at two Indian factories.
The impure drugs produced by Ranbaxy included an antibiotic and epilepsy treatment. The drugs have not led to any reported health issues.
Ranbaxy has also set aside an additional $500m to cover costs in the event of further criminal or civil suits.
“While we are disappointed by the conduct of the past that led to this investigation, we strongly believe that settling this matter now is in the best interest of all of Ranbaxy’s stakeholders,” said Arun Sawhney, chief executive and managing director of Ranbaxy, in a statement.
The fine “does not materially impact our current financial situation or performance”, he added