A woman sees a child fall down a well, so she climbs a fence onto private property to save the child’s life. In the unlikely event that the woman were charged with criminal trespassing, her attorney would use a choice-of-evils defense, also known as a necessity defense, to get her acquitted. He would argue that the child faced an immediate physical threat, and that it was necessary for his client to break the law in order to prevent the child from dying. But what if the threat were something less discrete than a well—the air, the water, the very ground beneath our feet? What if it imperilled every child in a neighborhood, or on the planet? Would the necessity defense still hold?

Last week, in a Boston municipal courthouse, thirteen defendants brought that question before Judge Mary Ann Driscoll. They had been arrested, in 2016, while protesting the construction of a high-pressure natural-gas pipeline in the neighborhood of West Roxbury, and claimed that their acts of civil disobedience—trespassing, disorderly conduct, resisting arrest—were necessary to forestall both local and global threats. In their testimony to Driscoll, some of the defendants focussed on community safety. The pipeline route, they noted, went through densely populated streets, past an active quarry where bedrock is regularly blasted. According to calculations made for comparable pipelines, an explosion could incinerate an area of at least thirty city blocks. Others discussed rising greenhouse-gas emissions and the harm that climate change is inflicting on people around the world. Driscoll listened to the defendants silently and, after the last one testified, announced that she found them not guilty—that their actions were justified by reason of necessity. She acquitted them without so much as an administrative fee.

Traditionally, in the law, necessity has been a narrow defense. It can be difficult to prove, and is usually limited to cases in which the threat is clear and concrete. Mark Silverstein, the legal director of the American Civil Liberties Union of Colorado, told me that, at the start of a civil-disobedience trial, prosecutors often file a motion to bar their opponents from presenting a necessity defense. “They say, ‘Don’t give us any funny business about why you sat in the road; the issue is whether you sat in the road,’ ” Silverstein explained. But that hasn’t stopped protesters from trying anyway. One common strategy, Silverstein said, is to pursue a jury nullification, in which a jury returns a not-guilty verdict, despite clear and indisputable evidence to the contrary, because the jurors find the charges unjust. In such cases, Silverstein said, “they are putting the law on trial.” Even when a necessity defense fails, he continued, it can give protesters a chance to appeal to the public. “It’s sometimes considered a victory if they got to present the evidence—why nuclear weapons, or the Vietnam war, or climate change are bad,” Silverstein said. “It’s a way to bring attention to the issue.”

West Roxbury’s anti-pipeline movement began in 2015, when Spectra Energy, a Houston-based company, broke ground on a five-mile-long extension of the Algonquin Gas Transmission Pipeline, which carries fracked natural gas from Lambertville, New Jersey, to Boston. (Last February, Spectra was bought by the Canadian multinational Enbridge, which the Obama Administration fined more than sixty million dollars, in 2010, after hundreds of thousands of gallons of crude oil from one of the company’s pipelines spilled into the Kalamazoo River, in Michigan.) City leaders opposed the extension, but the Federal Energy Regulatory Commission had issued Spectra a permit, so the company proceeded to dig up the roads. When it became clear that legal means of protest weren’t working—petitions, public comments, an ongoing challenge against the F.E.R.C. permit in federal court—an organization called the Climate Disobedience Center started training hundreds of protesters. Veterans of the antiwar and anti-nuclear demonstrations of the nineteen-seventies joined in.

Over the course of about thirty actions, the protesters sat down in front of backhoes, chained themselves to fences, and dropped into the pipeline’s construction trench, decorating it with flowers. They prayed, sang songs, and chanted, “No gasification without representation!” On June 29, 2016, twenty-three of the boldest activists lay down in the trench and refused to move. In Pakistan that summer, people had dug mass graves in advance of a predicted heat wave. “We recognized that trenches like the ones being dug in Pakistan were caused by trenches like the one we were resisting in West Roxbury,” Marla Marcum, a Methodist pastor and a co-founder of the Climate Disobedience Center, told me. The Boston Fire Department’s technical-rescue squad had to lift or roll the protesters onto stretchers and haul them out of the trench with ropes. By September 29th, the day of the final action, a hundred and ninety-eight people had been arrested. Many pleaded guilty to trespassing or disturbing the peace and were put on a six-month pretrial probation, after which the charges were dropped.

The pipeline entered service on January 5, 2017, but the activists still hoped to bring attention to their fight, this time in the courtroom. From the beginning, the thirteen defendants who appeared before Driscoll planned to present a necessity defense, including testimony from expert witnesses such as James Hansen, the climate scientist who alerted Congress to global warming, in 1988. During the discovery process, which dragged on for more than a year, the defendants and the judge pressed Spectra on a range of issues, including its safety plan for the pipeline. In November, after months of delay, the company’s lawyer submitted an affidavit admitting that no such plan existed. Revelations like that, Marcum said, have made the process worthwhile. Last Tuesday, perhaps recognizing that the case had become a boondoggle, the prosecution downgraded the charges from criminal to civil, making the defendants’ infractions the equivalent of parking tickets. The case could have been over then, but, in an unusual move, Driscoll allowed the protesters to make their final statements. According to Alice Cherry, a co-founder of the Climate Defense Project, which helped represent the West Roxbury activists, Driscoll’s ruling was the first of its kind in a civil case involving climate protesters.

The night after the ruling, the defendants held a public forum in the basement of a church in Jamaica Plain, near West Roxbury. “Communities like this one are fighting these kinds of fights all over the country,” the climate activist Tim DeChristopher said. “There is a sustained resistance, and it’s shifting the way these companies are doing business.” Prior to his involvement in the West Roxbury case, DeChristopher spent almost two years in prison for disrupting a government auction of oil and gas leases on sensitive public lands in Utah. Although his lawyer in that case, Patrick Shea, doesn’t anticipate that the necessity defense will become more common in civil-disobedience trials anytime soon, he noted that Driscoll’s ruling is consistent with “the drift of the judiciary.” Shea cited an ongoing federal lawsuit brought by a group of teen-agers, who argue that the government’s actions and inactions on climate change have, in the words of U.S. District Court Judge Ann Aiken, “so profoundly damaged our home planet that they threaten plaintiffs’ fundamental constitutional rights to life and liberty.” The suit recently made it through the Ninth Circuit Court of Appeals, over the Trump Administration’s objections. Meanwhile, climate-change activists in Minnesota and Washington State are preparing necessity defenses of their own. “In the beginning, you really didn’t have legal standing to challenge environmental matters,” Shea said. “But the wonderful thing about common law is that judges can begin to architect changes in it that reflect increasing scientific knowledge.”

At one point during the Jamaica Plain forum, Marcum called for a moment of silence, in recognition of the fact that “interactions with the criminal-justice system in this country are not all the same.” She noted that Driscoll’s ruling had come in the same week that Louisiana’s attorney general declined to prosecute a pair of white police officers who fatally shot Alton Sterling, a black man, in 2016. Boston is among the most segregated cities in the country; residents of West Roxbury, which is three-quarters white, tend to emphasize the “West,” to distinguish their neighborhood from nearby Roxbury, which is majority black. One of the only African-Americans arrested in West Roxbury was the Reverend Mariama White-Hammond, a climate-justice activist who has been working to bridge Boston’s racial divide through environmentalism. At the mass-graves protest, in 2016, she spoke to the crowd. “I debated whether or not it’s good to be here today, because all of these officers have to be here, and if I had my choice, I’d rather them be figuring out the sources of violence in our neighborhood and working to stop it,” she said. “But I’m here today because I believe we can lay to rest the spirit of exploitation and extraction that has brought us to such a terrible place.”