By Aaron Kuriloff And Ryan Tracy 

Doral Bank in Puerto Rico was closed by regulators Friday, with a botched announcement of its failure culminating years of turmoil that cost investors, including Goldman Sachs Group Inc. and Marathon Asset Management, hundreds of millions of dollars.

The failure of the bank, which had $5.9 billion in assets, was the largest in the U.S. since 2010. While many had anticipated the bank would be closed, as its market capitalization had shriveled to less than $10 million, its shares plummeted 46% on Friday afternoon after the Federal Deposit Insurance Corp. prematurely made the announcement during market hours.

The FDIC said the banking operations for parent Doral Financial Corp. were sold to Banco Popular de Puerto Rico. Doral's 26 branches will reopen for normal business hours on Saturday. The FDIC will continue to insure deposits, and customers can continue to access their money by writing checks or using ATM and debit cards, the FDIC said.

The sale cost the FDIC rescue fund, paid for by insurance premiums from banks, almost $750 million.

The closure marked a capstone to years of financial difficulties, including improper accounting, recapitalization and two reverse stock splits that left shares languishing. It comes after an appeals court this week ruled Doral wasn't owed a $229 million tax refund, overturning a lower court decision to grant the money to the bank. That followed a January directive from the FDIC to have an adequate capital plan within 30 days.

Doral's failure was the fourth of a U.S. bank this year and the first in Puerto Rico since April 2010, when three firms failed. It was also the largest U.S. bank to fail since those Puerto Rican banks.

The FDIC announced the closure earlier than intended, with an official sending a statement at 3:03 p.m. EST, then asking reporters to disregard it minutes later. The error occurred when an FDIC employee drafted an email and pressed "send" too early, according to a person familiar with the matter.

An FDIC spokeswoman said the statement was "sent in error" and "we will review our process to avoid a repetition of this problem."

Because a bank closure involves FDIC staff entering a bank's branches and seizing assets, the agency typically waits to announce a closure until after the branches are shut for the day. It sometimes breaks that practice, however, in cases in which a bank has branches in several time zones. The idea is to ensure that local bank staff are present to assist with work associated with the closure. Doral's branches were scheduled to stay open as late as 6 p.m. EST.

"There was a screw-up," Bert Ely, a banking consultant, said of the Doral announcement. "You don't want the customers in the bank when all the FDIC people come in to close it, that just adds to the confusion."

Still, Doral's failure should have been no surprise to people following news about the bank, he said.

It wasn't the first time regulators botched a bank failure announcement. In 2009, the now-defunct Office of Thrift Supervision sent news about the closure of an Ohio lender and included two crossed-out sentences about the closure of another thrift in Pittsburgh. The closure of the Pittsburgh lender wasn't supposed to be announced that day.

Doral's problems began just before the financial crisis. Improper accounting forced Doral to restate earnings in 2006 with a 56% cut to profits. A $610 million recapitalization in 2007 by investors, including Goldman Sachs, Bear Stearns Merchant Banking and several hedge funds, failed to stabilize the bank.

Two reverse stock splits also failed to rejuvenate its shares. The stock tumbled again in May 2014 after the FDIC ruled the company couldn't count the disputed $229 million tax credit from Puerto Rico as capital that could be used to cover losses.

Puerto Rico has also struggled since the financial crisis. It has about $73 billion in debt and is battling with a weak economy, declining population and high unemployment. Its bonds are widely held by mutual funds and individuals because of their tax advantages, and some investors fear the island's problems could cause bondholder losses nationwide. As of Dec. 31, Doral Bank had about $4.1 billion in deposits, the FDIC statement said.

Banco Popular North America will operate Doral's three locations in New York City, and Centennial Bank will run its five branches in Florida.

"I think it gives stability to the banking sector here and it's a good transaction for us," said Popular Inc. CEO Richard Carrion.

Banco Popular will purchase $3.25 billion of Doral's assets after agreeing to pay a premium of 1.59% for the right to assume the bank's deposits.

The FDIC also entered into two separate agreements to sell $1.3 billion of Doral's assets to other parties, saying those sales are expected to close within 30 days and the agency would retain the remaining assets for now.

Write to Aaron Kuriloff at aaron.kuriloff@wsj.com and Ryan Tracy at ryan.tracy@wsj.com

Access Investor Kit for The Goldman Sachs Group, Inc.

Visit http://www.companyspotlight.com/partner?cp_code=P479&isin=US38141G1040

Subscribe to WSJ: http://online.wsj.com?mod=djnwires