A circuit court judge in Virginia dismissed a suit that charged BNY Mellon with overcharging the state’s pension fund for foreign exchange transactions.

Fairfax County judge R. Terence Ney dismissed all claims made by the state of Virginia as well as counterclaims by BNY Mellon, which had been charged with “reaping illicit profits” by adding hidden mark-up and mark-downs that caused the fund to overpay when buying currencies and receiving “much less than it should have for sells.”

The dismissal came as the Virginia Retirement System and BNY Mellon settled their differences, without naming the terms. The two signed a contract which extends the current relationship between BNY Mellon and VRS for five years and adds an optional renewal for another five years.

Office of state attorney general Ken Cuccinelli, which sought $1 billion in damages and penalties, in the case , said it could not comment on the specifics of the pact. But, it said in a statement, “this resolution has conferred significant financial benefits for Virginia employees and retirees.’’

BNY Mellon still faces charges involving its pricing practices for foreign exchange transactions in Florida, New York, Ohio and elsewhere.

The U.S. Justice Department also has alleged that the firm overcharged pensions funds, investment managers and mutual funds such as Fidelity Investments for foreign exchange services for at least a decade. The federal prosecutor has calculated that the overcharges totaled more than $1.5 billion. BNY Mellon has denied the charges.

BNY Mellon said it could not comment on whether it is close to reaching settlement with pension funds in other states. “We can’t comment on relationships with other clients,’’ said spokesman Kevin Heine.

But, he said, settling out of court can be preferable.

“We continue to defend ourselves where that’s appropriate,’’ he said. “But we will be pragmatic. These are commercial disputes.’’

Under the new contract, BNY Mellon will continue to provide the Virginia Retirement Service with custody, risk management, securities lending and foreign exchange services.

Pension funds, mutual funds and other asset managers typically trade in foreign exchange in order to buy stocks and bonds, with the currencies used in local markets.