Wells Fargo has agreed to pay California $5 million to settle allegations that it opened insurance policies for its customers and charged them without their consent.

The San Francisco-based company agreed to give up its insurance licenses for two years and to pay another $5 million if it ever wants to sell insurance in California again.

Insurance Commissioner Dave Jones accepted the settlement on Wednesday. He says company representatives issued about 1,500 insurance policies without the consent of customers. The settlement is part of a massive fake-accounts scandal that has tarnished the reputation of one of the nation’s largest banks.

Wells Fargo spokeswoman Catherine Pulley says the company has worked to make things right for customers and earn back their trust. It previously stopped issuing new insurance policies.