We meet all of the characters on the outskirts of the penal colony, where the officer is preparing the apparatus for the execution of the condemned man. The officer gives a bit of background about the colony and the machine. He attracts the explorer's interest, and tells him about how the condemned man was sentenced. This is about all we get as setup for the story.
The officer's explanation of the colony's judicial procedure troubles the explorer, and he begins to have the stirrings of a thought that perhaps something should be done. This unease grows worse the more he hears about the execution methods, deciding they are clearly unjust and inhumane.
Once the condemned man is set in the apparatus, the officer starts to tell the explorer the truth of his situation: no one else in the colony supports the use of the apparatus. The explorer is at pleased to know that he can have influence, but feels reluctant to tell the officer "No" outright. Finally, he's put on the spot.
When the explorer tells the officer his negative opinion of the apparatus, it resolves the explorer's dilemma about whether and how to intervene. It also decides the officer's fate: his last hope has been crushed. But what will he do?
The officer announces that "the time has come" with resignation. We have a pretty good idea of what he's going to do, and when he strips naked we know it: he'll put himself in the apparatus. As he does so, however, we see various indications that things aren't going quite according to plan. Then the machine starts spitting out cogwheels and all hell breaks loose. The officer, trapped in the machine, is massacred before the horrified explorer's eyes.
With the officer dead and the machine kaput, there's not really any suspense left. The explorer sees the old Commandant's grave in the teahouse, as well as the people laughing at it. Without the officer and the machine, there's not much left of the old Commandant's legacy besides an epitaph that no one takes seriously.
The explorer, quite troubled by all he has seen, leaves the colony and its inhabitants behind. He wards off the condemned man and the soldier to ensure that nothing from the colony comes back with him where he is going. That's as close as we'll get to closure.