This time around, though, Goldman and Morgan Stanley might need to adjust those plans. Both Wall Street firms came perilously close to falling below the Fed’s minimum level on a key metric, the so-called supplementary leverage ratio. It is intended to measure the ability of banks to withstand severe economic distress, and the test punishes companies for a heavy reliance on borrowed money and for exposure to assets that are not on their balance sheets.

The Fed requires large banks to maintain a supplementary leverage ratio of at least 3 percent of their assets and certain other positions. Goldman’s ratio was as low as 3.1 percent under the stress tests, while Morgan Stanley’s lowest was 3.3 percent. (Under a separate measurement in the tests, Goldman had a 5.6 percent capital ratio, and Morgan Stanley’s was 7.3 percent, safely above the Fed’s 4.5 percent minimum.)

Those low ratios mean the two banks might have to reconsider how much money they want to return to shareholders in the form of dividends and share buybacks. Next week, the Fed will run a more consequential round of stress tests, known as the Comprehensive Capital Analysis and Review, in which the regulator will decide whether banks are sufficiently strong and well-managed to warrant their dividend and buyback plans.

In a statement on Thursday, Goldman said its own of forecasts of how its capital levels would fare during downturns came up with different results than the Fed. The bank said it planned to discuss the divergence with the Fed ahead of next week’s test.

In a statement on Thursday, Goldman said it did not agree with the results of the Fed’s tests and that it planned to discuss the “divergence” between the bank’s measurements and the Fed’s ahead of next week’s test.

Morgan Stanley said in a statement that Thursday’s results “may not be indicative of the capital distributions that we will be permitted to make.”

Wells Fargo, which has faced a series of regulatory penalties stemming from its sales practices, was among the banks to easily clear the Fed’s hurdles. Its key capital ratio was 8.6 percent, above the Fed’s 4.5 percent minimum. That was the highest among the country’s five largest banks, as measured by assets.