Greece’s debt exchange offer to private investors ended on Thursday, with officials in Athens saying they were confident of the outcome and of further efforts in coming days to prop up the ailing country.

The offer for bondholders to voluntarily participate in the debt exchange passed at 10 p.m. on Thursday in Athens. Under the terms of the exchange, private investors were asked to trade their existing Greek bonds for new ones worth less than half as much — a steep loss, but one meant to avoid having their investments wiped out completely in a general default.

Officials are expected to announce the results on Friday morning, but news reports from Greece quoted local officials and bankers as saying that investors holding about 80 percent of Greece’s $260 billion in outstanding bonds have agreed to the swap.

“A historic process will be completed tonight,” Greek finance minister Evangelos Venizelos told the parliament, Bloomberg news reported from Athens.

Stock markets also appeared optimistic. European exchanges were up more than 2 percent, and Wall Street gained as well.

The Greek debt exchange is the largest ever such undertaking measured in terms of the amount of money involved, and is an integral part of a broader international rescue plan for the country.

If Greece produces adequate savings from the debt swap, then other euro-zone countries and the International Monetary Fund are poised to provide $170 billion in new loans to keep the country afloat for the next three years as it tries to reinvigorate its economy.

The final tally will determine what happens next.

If participation falls short of 75 percent of the country’s outstanding bonds, the exchange may be called off — putting the international rescue program into doubt and leaving the country facing bankruptcy later this month when a major bond payment falls due.

If participation is higher than 90 percent, the debt exchange will be completed, clearing the way for the new international loans.

If participation falls in between — as many analysts consider likely — Greece will have to decide whether to use the legal tools it has available to force any holdout investors into the exchange.

That step has the potential to upset European financial markets, and won’t be announced until a planned conference call on Friday between Greece and European finance ministers.

After nearly two years in which the country struggled under a prior IMF-designed program that left it in a deepening recession, the debt exchange is intended as an important step toward solvency.

It will shave the country’s outstanding, privately held debt by about $130 billion; another $30 billion in “sweeteners” is being provided to Greece’s private investors by other European countries to entice those investors into the exchange and further defray Greece’s costs.

The IMF has tentatively scheduled a board meeting for Thursday to review the bond exchange outcome and approve its share of the country’s new rescue program, an IMF official said.

While the new program will give Greece three years of breathing room, where it leaves the country in the long term is another matter. Even if all goes well, the country would face one of the highest debt levels in the world for years to come.

And with much of that debt now “socialized” on the books of the IMF and euro-zone governments and institutions, some analysts worry that Greece may have trouble courting private investors to come back to the country.