The setting is Dr. Stockmann's study. The windowpanes are broken. The doctor is picking up stones that have been thrown through the windows. His landlord sends a letter giving the Stockmanns notice that they have to move out. The doctor doesn't care because he is taking his family to the New World on Horster's next boat. Mrs. Stockmann asks him if they should move to another town in Norway, but the doctor replies that the population will be the same wherever he goes and he doesn't want his sons to grow up among the "lapdogs" of Norway. He thinks that in the New World things might be different.
Petra enters. Even though her supervisor at the school is "freethinking," she has been fired because of anonymous threats her supervisor received. Captain Horster arrives. He has been given notice by Vik, the owner of the ship he sails. He is not worried; he can easily get a job with an out of town ship owner, and he does not regret helping the Stockmanns. The mayor arrives, and he and the doctor go to talk in private. The mayor has come to give the doctor notice regarding his position as medical officer of the baths and to ask the doctor to leave town for a while. If, after six months or so, the doctor will publicly retract his statements, he might be hired again. The doctor furiously refuses. Then, the mayor suggests that he has a reason for feeling so secure in his defiance--Morten Kiil's will. The doctor does not understand, and the mayor explains that Kiil has provided for Mrs. Stockmann and the children in his will. The doctor is jubilant, and when the mayor suggests that Kiil might redraw his will in light of the doctor's recent actions, the doctor exclaims that, on the contrary, Kiil is happy to see the doctor causing trouble for the authorities. The mayor then accuses the doctor of merely speaking out in order to curry favor with Kiil and secure his family a part of the inheritance. The mayor then leaves, announcing that now that he has a weapon to use against the doctor, he can never get his job back. The doctor orders his wife to scrub wherever the mayor has been.
Morten Kiil arrives. He brings with him a large number of shares in the baths, which he has just bought. He is upset that his name might be tarnished by rumors started by the doctor that his tanneries are polluting the baths. He wants the doctor to retract his statements; to force him to do so, he has invested Mrs. Stockmann's inheritance in bath stocks. He was able to buy them very cheap that morning, and if the doctor retracts his statements about the baths, their value will skyrocket and Morten Kiil will own most of the baths--and start to make the repairs the doctor proposed. Kiil tells the doctor to come to a decision by that afternoon.
As Kiil leaves, Hovstad and Aslaksen enter. They also have a deal for Stockmann. They know that Kiil has been buying up stocks, and they propose to put the People's Herald at the doctor's disposal once he has control of the baths and let him pretend to fix the baths. They remind him that the press has a great deal of power in a free society. All they want is compensation to keep the paper in business. The doctor sarcastically responds that it would be a shame for a friend of the people like the People's Herald to go out of business, but since he is an enemy of the people, he could care less. He lunges for his cane and tries to drive the newspapermen out the window into the gutter. They manage to escape.
Mrs. Stockmann, Petra, and Captain Horster want to know what is going on, but before the doctor tells them, he writes "No!" three times on a card and sends it to Morten Kiil. He announces to his family that they are not going to sail for the New World but instead are going to stay and fight. Captain Horster invites them to stay in his house. He will continue his medical practice with the poorest patients, as everyone else will refuse him. He embraces his wife and asks her to look at how beautifully the sun is shining. He resolves to hunt down the wolves that control the city, and his only regret is that he doesn't know any men who can continue the mission after he dies. The doctor's sons arrive, having been sent home because they got into a fight. The doctor decides that he will set up a school for poor children in the great hall where he was branded an enemy of the people. Mrs. Stockmann, however, is still worried that the "wolves" might hunt him down. He replies that he is stronger than the wolves, because he stands alone.
By the end of An Enemy of the People, Dr. Stockmann's position has changed several times. Sometimes he seems to be proud that he is "an enemy of the people," but early in Act V he says that the words wound him and are lodged in his heart. What is consistent is a sense of honor and a short temper. His partial embrace of the title enemy of the people is full of sarcasm, as seen when he turns on Hovstad and Aslaksen with his cane. He spoke out against the tyranny of the majority, but he still sees that men like Hovstad have a lot of control, and he is sincerely happy to be Hovstad's enemy. Thus, he eagerly calls himself an enemy of the people to Hovstad's face, implying that corrupt Hovstad is the real enemy.
As righteous as Dr. Stockmann may be, we should note that he certainly makes things hard for himself. This is best captured in his decision to remain in town. He decides to stay because he is incredibly angry, and he wants to keep fighting. In Act II, we see the mayor accuse Dr. Stockmann of being forever resentful of authority, implying that the doctor has a history of attacking authority. Thus, Dr. Stockmann's position at the end of the play is as much a result of his morals as of his naturally defiant personality.
The end of the play provides an interesting contrast between Mrs. Stockmann and Petra. Mrs. Stockmann accepts her husband's eccentric behavior. Petra, on the other hand, eagerly supports him. When he remarks that he doesn't know who will carry on after he dies, Petra says that problem will be solved in time. Clearly, Petra can follow him--only she isn't a man. Ibsen is highly conscious of gender issues. In a play otherwise about the extent to which a free democracy is not free, Ibsen finds room to speak up for women. He also shows that the doctor's ideas, too, can be old-fashioned.