Cleansing the Land

Cleansing the Land is a main quest and achievement/trophy in the Fallout 4 add-on Far Harbor.

Detailed walkthrough
Cleansing the Land is a quest that requires the Sole Survivor either to destroy Far Harbor by utilizing the wind farm kill switch code, or to destroy the Children of Atom at the Nucleus, by using the nuclear launch key. Although destroying one of the two factions finishes the quest and grants the achievement, "Cleansing the Land," the player character can still choose to destroy both factions.

Both codes needed are obtained in the previous quest Best Left Forgotten.

When choosing to destroy Far Harbor, one can optionally give the nuclear launch key to High Confessor Tektus. Note that, by doing this, the player character can't go back and destroy the Nucleus as well, should they desire so. Tektus will praise them, but then urge them to destroy Far Harbor. To do so, the Sole Survivor will have to visit the wind farm maintenance and enter the kill switch code, in the Turbine 003 regulator terminal. This shuts down the wind farm, killing off the electricity needed to run the Fog Condensers around Far Harbor. As a result, Far Harbor will be engulfed in the Fog and the creatures that come with it. A message will be displayed, at this point, that you are now an enemy of Far Harbor. After activating the code and returning to Tektus, the player character will receive Atom's Bulwark. If either The Heretic or Witch Hunt were resolved aggressively, one will receive the title "Inquisitor" and the perk Inquisitor of Atom as rewards. If they resolved both quests peacefully, failed them, or avoided them altogether, they will instead receive the title "Crusader" and the perk Crusader of Atom. Both perks have the same effects, and the difference is merely how some NPCs address the Sole Survivor. Then, Far Harbor, itself, will turn into ruins covered in fog and overrun by creatures, a legendary fog crawler being amongst them. Almost all Harbormen are dead, with only a few making a desperate last stand.

When choosing to destroy the Nucleus, the player character will have to insert the nuclear launch key in the Vessel. Doing so will turn all Children of Atom hostile and will initiate a 30 second countdown, upon which the submarine will go into lockdown, immediately followed by the launch of the nuclear warheads. As long as the key wasn't given to Tektus, it is also possible to convince him, through speech checks, that it is the will of Atom to launch the nuke, which will allow the player character to leave the Nucleus without being attacked. The Sole Survivor has 30 seconds to leave the Nucleus, before launch. Once outside the building, one will be safe from the explosion. Once the Nucleus explodes, the player character will be given the Far Harbor Survivalist perk. Upon returning to Far Harbor, there will be a commotion, with Harbormen gathering around and Captain Avery announcing that there was, indeed, a nuclear detonation, and that all Children of Atom are dead. Allen Lee will react happily about the news, but Avery will insist upon a moment of silence.

When talking to Allen, he will call the player character a hero and reward them with 1600 caps.

Bugs

 * Choosing to use the launch key and then staying in the Nucleus to watch the launch may crash the game.
 * Confronting DiMA about the wind turbines or the nuclear launch codes might not be possible, despite him being an active quest marker. This may be caused by Reformation already being in progress. It may also be impossible even without the Reformation quest started.
 * Taking actions that make the Children of Atom hostile, such as killing Grand Zealot Richter, before obtaining DiMA's memories and starting Cleansing the Land will prevent the dialogue option to confront DiMA about the nuclear launch key from appearing.