Morgan Stanley agreed to pay $249 million in penalties to resolve investigations by federal prosecutors and securities regulators into the firm’s practices in handling some large stock trades, authorities and the bank said on Friday.

As part of the settlement, Morgan Stanley entered into a nonprosecution agreement with the government and will not be charged with any criminal wrongdoing.

The investigations found that at least one employee at the bank had misused confidential information in connection with so-called block trades of stocks by some of its customers, according to statements and filings released by federal prosecutors in Manhattan and the Securities and Exchange Commission. Authorities said the conduct took place from 2018 to 2021.

Federal prosecutors said in a statement that Morgan Stanley had not uncovered the deceptive trading on its own nor did it report it to the authorities. But prosecutors said that they had decided not to file criminal charges against Morgan Stanley because the bank had cooperated with the investigation and because there was no evidence that the bank’s corporate management had knowledge of any wrongdoing.

Prosecutors, however, did enter into a deferred prosecution agreement with Pawan Passi, a former Morgan Stanley employee who supervised most of the bank’s block trading from 2018 to 2021. Prosecutors said Mr. Passi admitted that he had shared confidential information about some customers’ planned big stock trades with other investors so that they could “trade in advance of the block sales.”

Block trades are large enough that they can move the prices of stock, and advance knowledge of those trades can be profitable to traders, in particular hedge funds.

Gary Gensler, the S.E.C. chair, said in a statement that Morgan Stanley profited from the misuse of confidential customer information by “using it to position themselves ahead of those trades.” The regulator also said the investors that received the confidential trading information would take short positions ahead of those large stock sales in anticipation of the stock price declining.

In effect, the securities regulator said the Wall Street bank had engaged in front-running of the customers it was handling the sale of block trades, although the S.E.C. does not use that wording in the cease-and-desist order Morgan Stanley agreed to with the S.E.C.

The S.E.C. said that in one instance, a Morgan Stanley employee discussed a block trade of shares of Invitation Homes, a single-family rental company, with a trader working in the London office of a hedge fund. The hedge fund trader subsequently shorted shares of Invitation Homes.

Mr. Passi, who was charged with one count of securities fraud, is scheduled to appear Friday morning before a U.S. magistrate judge in connection with the deferred prosecution agreement. If the judge approves the deal, the criminal charges against Mr. Passi will be dismissed in about six months if he complies with the terms of the agreement.

“Morgan Stanley, through the supervisor of its block trades business, Pawan Passi, deceived customers,” said Damian Williams, U.S. attorney for the Southern District of New York. “While many factors weighed in Morgan Stanley’s favor, including extraordinary cooperation and remediation, the misconduct was not uncovered and voluntarily disclosed.”

Morgan Stanley said in a statement that it was “pleased to resolve these investigations” and added that it had already made enhancements “to our controls around block trading.”

George Canellos, a lawyer for Mr. Passi, said in a statement, “We are pleased that the U.S. Attorney’s Office agreed not to pursue a criminal conviction of Mr. Passi in this complex matter.”

Mr. Passi had worked for Morgan Stanley for about dozen years before the firm “discharged” him because of the investigation, according a brokerage industry report.

The penalties imposed by federal prosecutors and the S.E.C. against Morgan Stanley totaled a little over $400 million. But because the two settlements gave Morgan Stanley credits for overlapping payments, the total amount being paid by the Wall Street firm is $249 million.

The Wall Street bank’s cooperation included putting in place remedial measures that involved better training for employees and clearer policies for block trading.