LONDON (AP) — HSBC avoided a legal battle that could further savage its reputation and undermine confidence in the global banking system by agreeing Tuesday to pay $1.9 billion to settle a U.S. money-laundering probe.

Europe's largest bank by market value will pay the biggest penalty ever imposed on a bank after facing accusations it transferred funds through the U.S. from Mexican drug cartels and on behalf of nations such as Iran that are under international sanctions.

It's the latest scandal to hit banks over recent years since the financial crisis started in 2008. Hours earlier, Standard Chartered PLC, another British bank, signed an agreement with New York regulators to settle a money laundering investigation involving Iran with a $340 million payment.

"These banks are operating in an environment where you can't afford to have uncertainty attached to your name, and they are dependent on confidence from their investors," said Sabine Bauer, director of financial institutions at Fitch Ratings. "And that makes them keen to get past such events very quickly and settle."

Despite the high price of the settlement, markets greeted the HSBC's swift agreement. HSBC Holdings PLC's share price in London was trading 0.2 percent higher at 642 pence. Standard Chartered's was flat at 1,498 pence.

Analysts said two British-based banks will be able to absorb the cost of the settlements.

According to Shore Capital analyst Gary Greenwood, the penalties are equivalent to around 9 percent of each company's 2012 pretax profits.

"The certainty is clearly welcome and helps to draw a line under the situation," said Greenwood. "In terms of knock-on effects, we think it is likely to lead to higher ongoing compliance costs and perhaps some minor loss of business in the U.S, but nothing that will be particularly material to either company."

Banks are facing greater scrutiny since the financial crisis. A string of banking scandals have highlighted lax oversight and a culture of arrogance and entitlement.

Money laundering by banks has become a priority target for U.S. law enforcement. Since 2009, Credit Suisse, Barclays, Lloyds, and ING have all paid big settlements related to allegations that they moved money for people or companies that were on the U.S. sanctions list.

HSBC conceded that its anti-money laundering measures were inadequate and that it has taken big steps in beefing up its controls. The bank also said it has reached agreements over investigations by other U.S. government agencies and expects to sign an agreement with British regulators shortly.

"We accept responsibility for our past mistakes," said HSBC Chief Executive Stuart Gulliver. "We have said we are profoundly sorry for them, and we do so again."

A U.S. law enforcement official said the sum HSBC was paying would include $1.25 billion in forfeiture — the largest ever in a case involving a bank — and $655 million in civil penalties.

Under what is known as a deferred prosecution agreement, the financial institution will be accused of violating the Bank Secrecy Act and the Trading With the Enemy Act, the official said. The source spoke only on condition of anonymity because officials were not authorized to speak about the matter on the record.

In return for being spared prosecution, HSBC said it would continue to strengthen its compliance policies and procedures. Its performance will be evaluated by an independent monitor over the 5-year term of the agreement with the Department of Justice, which has used such arrangements in cases involving large corporations, notably in settlements of foreign bribery charges.

"The HSBC of today is a fundamentally different organization from the one that made those mistakes," said HSBC's Gulliver. "Over the last two years, under new senior leadership, we have been taking concrete steps to put right what went wrong and to participate actively with government authorities in bringing to light and addressing these matters."

Last summer, a Senate investigation concluded that HSBC's lax controls exposed it to money laundering and terrorist financing.

In regard to HSBC and Mexico, the Senate investigative committee reported that in 2007 and 2008 HSBC Mexico sent about $7 billion in cash to the United States. It said such a large amount indicated illegal drug proceeds.

HSBC affiliates also skirted U.S. government bans on financial transactions with Iran and other countries, according to the report from the Senate Permanent Subcommittee on Investigations. And HSBC's U.S. division provided money and banking services to some banks in Saudi Arabia and Bangladesh thought to have helped fund al-Qaida and other terrorist groups, the report said.

The report also blamed U.S. regulators, claiming they knew the bank had a poor system to detect problems but failed to take action.

Sen. Carl Levin, D-Mich., the committee chairman, cited instances in which HSBC had promised to fix deficiencies after being sanctioned by regulators but failed to follow through.

Levin also said the Office of the Comptroller of the Currency, the U.S. agency that oversees the biggest banks, tolerated HSBC's weak controls against money laundering for years and said agency examiners who had raised concerns were overruled by their superiors.

HSBC, which had a 2011 net income of $16.8 billion and operates in about 80 countries, has grown quickly in recent years by acquiring banks around the world that became its affiliates. Its far-flung affiliates operated with a degree of autonomy that left top bank officials with less than full authority and control, experts say. Each affiliate had its own officer to oversee compliance with laws to prevent money laundering.

Nigel Morris-Cotterill, head of the Anti Money Laundering Network, a consultancy, said international banks face conflicts between laws and regulations in different countries.

"There are times when the lines are blurred, when you're not clear exactly where the edge is," he said. "If you step over the edge you get slapped, but often you don't know where the edge is."

On Monday, HSBC announced that Robert Werner, a former head of the Treasury Department agencies responsible for sanctions against terrorist financing and money laundering, is taking a new position in HSBC as head of group financial crime compliance and group money-laundering reporting officer. Werner has been head of global standards assurance since August.

In January, HSBC hired Stuart Levey, a former Treasury undersecretary for terrorism and financial intelligence, as its chief legal officer. And a former policy adviser in the Obama administration, Preeta Bansal, in October became HSBC's global general counsel for litigation and regulatory affairs.

___

Marcy Gordon in Washington, DC and Kelvin Chan in Hong Kong contributed to this report. Yost contributed from Washington, DC.