India's trade minister Anand Sharma speaks about food security during a news conference at the ninth World Trade Organization (WTO) Ministerial Conference in Nusa Dua, on the Indonesian resort island of Bali. (Edgar Su/Reuters)

World trade negotiators neared agreement late Friday in Indonesia on a global trade deal that temporarily resolves a dispute between the U.S. and India over agricultural policy — and at least for now salvages the reputation of the World Trade Organization.

The deal, still being discussed as midnight approached on the Balinese resort of Nusa Dua, allows U.S. and other negotiators to avoid the worst — a collapse in talks that could have left the WTO with little or no value as a negotiating forum.

But the agreement was modest by any measure. India will be allowed to keep new agriculture subisdies in place with no firm deadline for complying with WTO subsidy rules. A committee will be set up to keep negotiating over a compliance schedule, marking an important concession by U.S. officials who wanted committments from India up front.

Countries also agreed to begin a process that will over time make it easier for importers and exporters to move goods into and through different countries — an end sought by the U.S. and pushed by international businesses.

While limited, the agreement was nonetheless being billed as “historic” by negotiators since it marks the first time the world trade group has managed to produce any meaningful change to the global trading system it was set up two decades ago to monitor and enforce.

Ahead of the current meetings, India and the United States were deadlocked over new Indian agriculture subsidies that the country said are integral to food security for its tens of millions of poor people. The United States worries the progrma will damage regional agriculture markets and hurt smaller countries by encouraging overproduction, and leading India to dump surplus food.

The Bali meeting had been organized with purposefully low expectations. The focus was to agree on issues, such as ways to ease the passage of goods across borders, of such wide benefit and little controversy that they could easily win consensus. Even that narrower sort of agreement was considered important — and of particular interest to U.S. and global businesses that ship parts and goods through multiple countries to make final products. The new WTO director general, Roberto Azevedo, focused his first months in office on completing such a deal, and U.S. officials pressed hard to help.

But the session began early this week under what one European official dubbed “storm clouds of failure,” and it has only grown worse. By Thursday, U.S. Trade Representative Michael Froman said the WTO faced “a debilitating blow” if ministers adjourn without anything to show for the months of effort.

Talks continued until the early morning hours in Bali, in hopes of putting together an agreement that would at least save face for the organization.

For the Obama administration, the outcome in Bali has been frustrating. Even as recently as last week, administration officials thought they had reached a compromise with India that would allow the larger agreement to move ahead.

But it may also validate the administration’s decision to pursue a full slate of trade agreements outside the WTO. That strategy has been criticized as potentially undermining the goal of building a truly global set of trading rules. Given the difficulties in Bali — stemming from disputes over agriculture and development that have plagued the WTO for years — it may prove foresighted, the only alternative in the absence of a credible global negotiating forum.

The U.S. team is to leave Indonesia on Friday for Singapore, where it will continue talks over the 12-nation Trans-Pacific Partnership, a pact that Froman said he hoped could be largely finished this year.

The group includes major trading countries, such as Japan, Canada and Australia, and smaller but important Asian countries, such as Malaysia and Vietnam. South Korea recently expressed interest in joining.

That pact is being negotiated at the same time as a U.S.-Europe agreement. Between them, the two trade areas would encompass much of the global economy — perhaps prompting other countries to adapt and join, accomplishing in a piecemeal way what the WTO was unable to do with its global approach.

Even if the two agreements move forward, they would have to be approved by Congress, and, in the case of the TPP, criticism has been vocal and sometimes extensive. Lawmakers have demanded, for example, that the treaty include ways to prevent countries from using the value of their currency to gain an advantage in trade.