Swiss bank Credit Suisse AG has agreed to pay $536 million to in order to avoid criminal charges that it helped customers in Iran and other countries illegally funnel bank payments through the U.S.

In court papers filed Wednesday at the U.S. District Court for the District of Columbia, Credit Suisse admitted that it had helped Iranian customers and banks skirt U.S. sanctions by disguising the source of payments it then sent to other banks. According to Justice Department prosecutors, Credit Suisse had helped customers in countries such as Libya avoid sanctions as far back as 1986. Its efforts in Iran stretched at least into the mid-1990s, but business with the country picked up in 2003 after British bank Lloyds decided to terminate its business with Iranian customers.