Eli Lilly, the drug company, is expected to agree as soon as Thursday to pay $1.4 billion to settle criminal and civil charges that it illegally marketed its blockbuster antipsychotic drug Zyprexa for unauthorized use in patients particularly vulnerable to its risky side effects.

Details of the agreement were provided by people involved in the negotiations.

Among the charges, Lilly has been accused of a scheme stretching for years to persuade doctors to prescribe Zyprexa to two categories of patients  children and the elderly  for whom the drug was not federally approved and in whom its use was especially risky.

In one marketing effort, the company urged geriatricians to use Zyprexa to sedate unruly nursing home patients so as to reduce “nursing time and effort,” according to court documents. Like other antipsychotic drugs, Zyprexa increases the risks of sudden death, heart failure and life-threatening infections like pneumonia in elderly patients with dementia-related psychosis.

The company also pressed doctors to treat disruptive children with Zyprexa, court documents show, even though the medicine’s tendency to cause severe weight gain and metabolic disorders is particularly pronounced in children. Over the last decade, Zyprexa’s use in children has soared.