British Standard Chartered Bank, which had been accused by New York state's top banking regulator of engaging in illegal money-laundering on behalf of the Iranian regime in an explosive legal filing last week, is settling charges for a fine of $340 million.

The settlement with the regulator, mere hours before the bank executives and regulatory officials were set to sit down for a scheduled meeting to discuss whether or not the institution's charter would be revoked, came after a full-court press effort by the bank to secure an agreement and avoid a public showdown with the state government. Standard's Chartered chief executive flew into New York Monday to personally seal the deal.

The highly embarassing effort for Standard Chartered began last Monday, after the New York State Department of Financial Services released an uncanny legal document that claimed Standard Chartered engaged "in deceptive and fraudulent misconduct in order to move at least $250 billion through its New York branch on behalf of client Iranian financial institutions that were subject to U.S. economic sanctions." The bank, according to the document, "then covered up its transgressions."

Even before the agreement, the bank had accepted an order by the regulator to install on-site examiners. According to the statement from the Department of Financial Services, the monitors will remain in place for at least two years in order to oversee its international transactions .

The settlement is a huge win for the head of the DFS, Superintendent Benjamin Lawsky, who was widely seen as playing hardball to squeeze the bank into an uncomfortable position and extract tough concessions. Several media outlets, citing people familiar with talks between the bank and the DFS over the past week, said the regulator had initially asked for a fine of more than $700 million.

Notably, the regulator got the bank to admit that "the conduct at issue involved transactions of at least $250 billion," according to the statement from the DFS. The bank's initial reaction to the regulatory charges last Monday had been to claim the regulator was overstepping its bounds and that if any malfeasance was at play, it involved transactions of roughly $14 million.

The resolution to the case still leaves Standard Chartered open to further sanctions from federal officials and the Manhattan District Attorney's Office, all of whom were investigating the bank for the same issue.