Morgan Stanley Smith Barney has agreed to pay a fine of $13m to the Securities and Exchange Commission (SEC) to settle allegations of overbilling clients and violating the custody rule pertaining to annual surprise examinations.

The regulator accused Morgan Stanley of overcharging over 149,000 advisory clients by failing to implement compliance policies reasonably, and failing to validate billing rates in the firm’s billing system against client contracts, fee billing histories, and other documentation.

SEC said that the billing errors occurred between 2002 and 2016 and helped the company gain over $16m in surplus fees, which the company reimbursed to the affected clients along with interest.

SEC New York regional office director Andrew Calamari said: “Investors must be able to trust that their investment advisers have put appropriate safeguards in place to ensure accurate billing.  The long-running deficiencies in those safeguards at Morgan Stanley resulted in 36 different types of billing errors that caused overcharges to customers.”

The SEC also alleged Morgan Stanley of failing to meet the annual surprise custody examination requirements for two consecutive years.

The regulator said that the company did not provide its independent public accountant an accurate list of client funds and securities for examination and also failed to maintain client contracts.

Morgan Stanley agreed to the settlement without admitting or denying the charges.