If debate in Washington over raising the U.S. debt ceiling finally ends with a deal on Sunday, the last-minute reprieve could spark a relief rally when global markets open.

U.S. lawmakers were close to a last-gasp $3 trillion deal to raise the borrowing limit and avoid a potentially catastrophic default. Markets have been tumultuous throughout the protracted discussions, with Wall Street finishing its worst week in a year on Friday.

A deal of $2.8 trillion looks like the outcome and the mechanism is in place, and no default. That is enough to rally markets, said David Kotok, chief investment officer of Cumberland Advisors in Sarasota, Florida.

But the White House stressed that no deal had been reached yet. Communications director Dan Pfeiffer sounded a note of caution, saying in a tweet on Sunday that a lot of bad info is floating out there.

Wayne Kaufman, chief market analyst at John Thomas Financial in New York, said that after five down days on Wall Street the stock market was primed for a bounce. But he warned that options traders, who have been betting a deal will be struck, may get caught out.

There is the possibility this could go on for another few weeks, he said. It would probably be devastating for markets, but the possibility does exist.

Even if a deal is struck soon, markets remain nervous, and a relief pop in equities may be short-lived. This year, Wall Street has been quick to move from crisis to crisis. And those seem to be in almost endless supply.

The United States still faces a possible downgrade to its gold-plated AAA rating in the near future and that is likely to hit markets if it does eventually happen.

The initial shock of the downgrade will rattle the markets, said Peter Cardillo, chief market economist at Avalon Partners, New York. The chances of a downgrade are certainly greater now than a month ago.

Trading activity in the last few weeks suggests U.S. equities have been restrained by the paralysis in Washington.

Fears that a hamstrung government could be a deadweight on growth rose on Friday after a report showed the U.S. economy grew much more slowly than thought in the first half of the year.

A number of prominent investors have indicated they are holding larger-than-usual cash positions, and yields on some short-term U.S. debt maturing in August have soared.

Meanwhile the dollar, the world's safe haven during the 2008 financial crisis, hit a record low against the Swiss franc and a four-month trough against the Japanese yen on Friday. Both are now seen as a safer place to store cash than the United States.

A lack of a U.S. budget deal would also ratchet up the pressure on the dollar against the yen so much that it raises the prospect that Japan might intervene to stop its currency from strengthening.

The dollar fell on Friday to its lowest since coordinated intervention to weaken the Japanese currency in mid-March. It is now in striking distance of its all-time low of 76.250 yen, which it hit just before authorities intervened then.

Short-term money markets have been roiled, making it more costly for banks and companies. If that persists, consumers and small businesses may also find it harder to access credit. Those who can get loans will likely pay more for them.

Companies, meanwhile, are hardly likely to ramp up hiring if funding costs are on the rise. That became even more of a worry after data showed the U.S. economy grew at a plodding 1.3 percent pace in the second quarter and produced nearly flat growth in the first quarter.

This is exactly what the market does not need as economic conditions waver, Jim Caron, head of global interest rate strategy at Morgan Stanley, said in a research note.

Ironically, longer-dated Treasury debt has rallied, partly in reaction to the weaker-than-expected data, but also reflecting a flight to safety as investors move out of the way of the consequences a default may have on global markets.

(Additional reporting by Angela Moon and David Gaffen; Editing by Chris Sanders and Dale Hudson)