Johnson & Johnson has agreed to pay more than $2.2 billion in criminal and civil fines to settle accusations that it improperly promoted the antipsychotic drug Risperdal to older adults, children and people with developmental disabilities, the Justice Department said on Monday.

The agreement is the third-largest pharmaceutical settlement in United States history and the largest in a string of recent cases involving the marketing of antipsychotic and anti-seizure drugs to older dementia patients. It is part of a decade-long effort by the federal government to hold the health care giant — and other pharmaceutical companies — accountable for illegally marketing the drugs as a way to control patients with dementia in nursing homes and children with certain behavioral disabilities, despite the health risks of the drugs.

The settlement, which requires the approval of a federal judge, will also resolve accusations that the company inappropriately promoted two other drugs, the heart-failure drug Natrecor and Invega, a newer antipsychotic drug.

Much of the conduct highlighted in the case, which for Risperdal extends from 1999 through 2005, occurred while Alex Gorsky was vice president for sales and marketing and later president of the company’s pharmaceutical unit, Janssen. Mr. Gorsky became chief executive of Johnson & Johnson last year. Risperdal, which has lost its patent protection, was once one of the company’s best-selling drugs.