Protesters call Thursday for the rejection of the Trans-Pacific Partnership trade deal under negotiation in Atlanta. (Paul Handley/AFP/Getty Images)

The United States, Japan and 10 other Pacific Rim nations were on the verge of a final agreement Sunday night on the largest free-trade accord in a generation, an ambitious effort led by the Obama administration to knit together economies across a vast region.

The deal would cap more than five years of arduous negotiations on a project central to President Obama’s economic agenda and potentially hand him a legacy-defining victory late in his presidency.

Negotiators said that they were near a consensus on terms for the Trans-Pacific Partnership (TPP) after a feverish week of talks here among trade ministers who sought to close the gaps on several lingering disputes. Plans to publicly announce a deal in the afternoon were delayed several times as the parties wrangled over the technical details related to market access for dairy products and new-generation biologic medicines.

Those are just two sections of a sprawling, multiple-chapter pact that addresses tariff reductions for agriculture and automobiles as well as intellectual-property rights for pharmaceutical drugs and movies, the free flow of information on the Internet, wildlife conservation, online commerce and dispute settlements for multinational corporations.

U.S. officials said they were confident that meetings late Sunday and early Monday would produce a final agreement. Other nations also expressed optimism that a deal would be reached. The sense of urgency was palpable among the officials, who fear they are running out of time with political elections in Canada this month and the United States next year. Opponents of the deal have staged demonstrations inside and outside a Westin hotel in Atlanta, where the negotiators are meeting.

Trade ministers from a dozen Pacific nations in Trans-Pacific Partnership Ministers meeting in Atlanta. (Handout/Reuters)

The Obama administration has cast the accord as a historic effort to establish new rules of international commerce among a dozen nations at a time when evolving technologies are disrupting old industries and creating new ones. The 12 TPP nations — the others are Australia, Brunei, Chile, Malaysia, Mexico, New Zealand, Peru, Singapore and Vietnam — account for a combined 40 percent of the world’s gross domestic product.

Obama, who announced in 2011 that his administration would take a leading role in the negotiations, stands to realize a major victory with just over a year left in office. Initially skeptical of large trade deals when he entered the White House, Obama came to embrace the Pacific Rim pact as a way to bolster his strategy of rebalancing U.S. foreign policy toward Asia and maintaining an economic edge in the face of China’s growing clout.

“We can promote growth through trade that meets a higher standard,” Obama said in a speech at the United Nations in New York last week. “And that’s what we’re doing through the Trans-Pacific Partnership — a trade agreement that encompasses nearly 40 percent of the global economy, an agreement that will open markets while protecting the rights of workers and protecting the environment that enables development to be sustained.”

The president personally intervened in the final days of talks, having phone conversations with several leaders, including Australian Prime Minister Malcolm Turnbull. The final sticking points in Atlanta centered on the length of market protections for an emerging class of pharmaceuticals, tariffs for dairy products and rules governing how to classify where automobiles are manufactured.

Even if the deal is completed, Obama’s work is not yet done, however. Though he won new “fast-track” trade powers from Congress in the spring to help smooth negotiations, the president still must get the final pact ratified by a vote in Congress, which probably will take place early next year.

Lawmakers will not be allowed to amend or filibuster the TPP deal, but the vote will come during the presidential primary nominating contests. Candidates from both parties have lambasted U.S. trade policies as contributing to a reordering of the American economy that has led to a growing income gap.

Opponents of the deal, including labor unions, environmental groups and liberal Democrats, have pledged to mount a final campaign to block the accord on Capitol Hill. They have criticized the TPP as a regulatory framework aimed at protecting the interests of large multinational corporations while doing little to protect worker rights and the environment. U.S. officials have said that there are chapters in the agreement with enforceable provisions to do just that.

On Sunday morning, a handful of protesters unfurled a large banner reading “#StopTPP!” They chanted “TPP is corporate greed. Affordable medicine is what we need” before being removed from the lobby of the Westin hotel.

The Obama administration “is pursuing policies under extreme secrecy,” said Ilana Solomon, director of responsible trade for the Sierra Club, which has concerns about the environmental provisions in the deal. “The entire TPP has been negotiated behind closed doors. . . . The lack of dialogue is abysmal.”

The TPP represents the largest U.S. trade pact since the North American Free Trade Agreement with Canada and Mexico in 1993. The accord has its roots in the mid-2000s, when Brunei, Chile, New Zealand and Singapore began discussing a tiny regional trade pact.

The United States first declared an interest in joining the talks in the final year of the George W. Bush administration, and the negotiations grew to encompass eight nations. But Obama put a halt on U.S. efforts after taking office in 2009, amid a global recession.

A year later, Obama notified Congress of his administration’s intent to reenter the talks, and the White House’s support helped draw in additional countries, including Japan, the world’s third-largest economy, whose entry in 2013 helped boost the global scale of the pact.

In all, the 12 nations held more than three dozen negotiating sessions over the past five years.

Obama’s decision to make a concerted push to close the deal this year put the White House in a rare partnership with Republican leaders to push the fast-track powers through Congress in the spring. That effort angered much of his liberal base, but the legislation was approved in June after fierce political wrangling, passing with broad GOP support and a fraction of Democrats.

Under the terms of the fast-track legislation, Obama must wait 90 days after the TPP agreement is completed before he signs it and sends it to Congress for a vote, and the text of the accord must be made public for at least 60 of those days.

“There’s a lot at stake, and we are not the only party out there,” U.S. Trade Representative Michael B. Froman said Thursday. “The Asia-Pacific region is home to 3 billion middle-class consumers over the next 15 years, so it’s important that the rules of the road in that region are defined in a way that plays to the interests and values of the United States.”