In a rare moment of accord, Iranian and Western diplomats decided during nuclear talks this week to keep the details of their negotiations strictly secret. The fear, they said, was that even modest gains could be endangered if they were publicized prematurely.

“You need to allow us the space to move forward,” pleaded Catherine Ashton, the European Union’s foreign policy chief.

But Ashton had barely uttered the words when the first salvos landed from skeptics of a possible nuclear deal with Iran. Opponents in Tehran and Washington rejected the Geneva proposals even before the details were publicly known.

Prominent U.S. lawmakers such as Sen. Marco Rubio (R-Fla.) declared their opposition to granting Iran any relief from sanctions, suggesting instead that economic penalties should be made even tougher. And an Iranian legislator suggested that a compromise on Iran’s nuclear capabilities will not be acceptable.

“The West must accept our homegrown nuclear energy and enrichment in Iran and lift the sanctions for talks to have any hope,” said Mansour Haghighatpour, a member of the Iranian lawmaking body’s national security and foreign policy commission.

The harsh reaction partly explains why many experts assess the ­chances of an Iranian nuclear deal as low, despite the progress reportedly made during two days of talks in this Swiss city. Diplomats from the United States and five other world powers praised Iran for engaging in serious discussions over a proposal to tighten restrictions on the country’s nuclear program in exchange for gradual easing of economic sanctions.

“I’ve never had such intense, detailed, straight­forward, candid conversations with the Iranian delegation before,” said a senior Obama administration official, speaking on the condition of anonymity to describe the negotiations, which will reconvene early next month.

White House officials insist that the administration will never accept a deal or agree to relax sanctions unless Iran commits to significant constraints that will ensure it can never use its nuclear facilities to make atomic weapons. But the efforts to resolve the nuclear standoff with Iran has stoked fears among key U.S. allies — including Israel and Gulf Arab states — as well as from key U.S. lawmakers.

Congress has passed a series of ever-harsher economic sanctions on Iran with near-unanimous approval, and several senators have warned that they would oppose any deal that allows Iran to enrich uranium, even with restrictions to ensure that the nuclear fuel is used only to make electricity.

“Even a limited enrichment program and possession of sensitive reprocessing technologies is unacceptable because it would keep the path to nuclear weapons open,” Rubio wrote in an op-ed published in USA Today on Tuesday, as the Geneva talks were getting underway.

U.S. officials acknowledge that skepticism is warranted, given Iran’s long history of concealing key parts of its nuclear program, including both of its uranium enrichment plants, which were built in secret.

But the White House is optimistic that Congress as well as allies will eventually line up behind a deal that offers a non­military solution to the Iranian nuclear crisis.

“If we have what I would call a high-class problem of a verifiable, sound agreement that addresses all international concerns about Iran’s nuclear program, I feel pretty confident that everyone who is engaged in this process will support that outcome,” the administration official said.

But some Middle East experts see little evidence of flexibility in Congress.

“One would be mistaken to not take into account the resistance — automatic resistance — that some elements in Congress will put forward to any deal,” said Trita Parsi, author of “A Single Roll of the Dice,” a book about U.S. relations with Iran.

Hard-liners in Iran are equally adamant. Just as nuclear talks are beginning to spark hopes of an end to crippling international sanctions, conservative politicians and clerics are becoming more vocal about their objections to a possible rapprochement with the United States. The reaction has served as a reminder that Iran’s pragmatic new president, Hassan Rouhani, has multiple constituencies to answer to — including Iran’s supreme leader, Ayatollah Ali Khamenei — and placating them all will be difficult.

For the majority of Iranians, the key test of the negotiations’ success is whether they lead to the lifting of sanctions.

“Taking away the sanctions would give us a psychological boost, which is always good for business and good for people,” said Hossein Mohseni, a furniture importer who has watched his sales continue to slide, even since Rouhani took office in August.

Besides banking and oil sanctions, which have limited Iran’s revenue, restrictions on shipping are making the import and export of goods nearly impossible, doing serious damage to consumer trade.

Rezaian reported from Tehran.