STOCKHOLM — It was the middle of the night. In a matter of hours, journalists from around the world would be showing up, expecting details about the latest big United Nations climate report. But behind closed doors here, as the final wording of that document was being worked out, things were not going well.

Inside an old brewery converted into a conference center, scientists and diplomats fought off hunger pangs and joked about having their 15th cup of coffee. As the hours dragged by, several countries — with Saudi Arabia and China in the lead — raised one objection after another to a small section of the report. Reto Knutti, a Swiss scientist, spent much of the night in the hot seat, answering questions.

The idea he was defending was that scientists should specify a worldwide cap on global emissions of greenhouse gases — “a carbon cap” — that would apply if countries were serious about staying below an internationally agreed upper limit on global warming. It was just a single paragraph, but it had huge implications, and everyone in the room knew it. If it were adopted, it would make starkly clear how far the world remains from having any meaningful policy to tackle climate change.

“It was inconveniently simple,” Dr. Knutti would say a few days later.

As the questions flew, Dr. Knutti kept a graduate student awake all night at his home institution, the Swiss Federal Institute of Technology in Zurich, running computations. In the end, Dr. Knutti and his scientific colleagues prevailed, thanks in part to an intervention from the United States delegation.