A group of children play in the courtyard of an apartment building, as one leads the group a macabre little ditty about a man who dices up children. The song is about a child killer currently on the lam, as we learn from poster on a signpost warning the public of his crimes.
A shadow falls across that poster as a little girl bounces her ball against the post on which it has been plastered. A man’s voice compliments her ball and asks her name. This is Elsie.
The man whistles Edvard Grieg's "In the Hall of the Mountain King" as he takes Elsie to buy a balloon from a blind man on the street. This man is Hans Beckert, clad in a long coat and fedora just like so many other men on the street. Meanwhile, Elsie's mother is growing increasingly worried that Elsie has not yet returned home from school, starting to ask people in her building if they've seen her daughter. She is beginning to fear for the worst and, indeed, we soon see Elsie's ball roll into the middle of a dusty field and her balloon float up into electrical wires. Beckert has killed her.
A newspaper report on the latest child victim ramps up calls for more police action. Beckert stokes the flames by sending a taunting letter to the newspaper, anonymously claiming responsibility for his crimes and feigning outrage that the police ignored the letter he sent to them. The police, meanwhile, launch a city-wide investigation into the haunts of all known criminals and criminal organizations in the city. As police start busting speakeasies, the underworld chafes.
The city's gang leaders meet to discuss how to deal with the situation, as increased police activity is cutting into profits from organized crime. Here we meet the leader of the underworld Der Schränker and his lackey Franz. Simultaneously, we watch a meeting of government officials where the police chief, Inspector Lohmann, hatches a new plan to investigate any patients in local mental health asylums who have a history of violence against children.
While the police strike up a new investigation, the heads of the underworld decide it is their own responsibility to catch the killer. They believe the police are ineffective, so they must deal with the murderer themselves. The devise a plan to mobilize the city's street people as a vast surveillance system, offering a substantial reward to the man that catches the predator.
We see anxious crowds on the street confronting any older man who is seen talking to children, and our sense grows that the public's own brand of justice will be swift, regardless of guilt or innocence. We're learning the the crowd may be just as thirsty for blood as the killer himself.
We see Beckert approach another young girl on the street, potentially his next victim. Like with Elsie, Beckert takes this new girl to buy a balloon from the blind vendor while whistling the Grieg tune. The blind man suspects that this whistling man was the same who bought a balloon for Elsie the day she disappeared, and runs to enlist another street person who can pursue this man.
Like that, the enlisted man follows Beckert and the girl. He draws an "M" on his hand in chalk and, at the right moment, bumps into Beckert and slaps him on his back. Even though the girl informs Beckert that he has some chalk on his back, Beckert fails to brush it off. He is now labeled with an M for murderer.
Once again, we are treated to the dual timelines of the police and the underworld. Inspector Lohmann is going around town inspecting the apartments of people of interest, looking for materials that may have been used to write the letters that the killer sent to the police and the newspaper. The street people, on the other hand, chase and soon corner Beckert, as the girls gets away safe.
When Beckert is finally cornered, he escapes into an office building just as it's closing. The street people can't manage to follow, so they get word back to Der Schränker. The gang quickly sends a team out to break into the office building and find Beckert.
The gang ties up the security guards at the building and undertakes a systematic search of the premises. Beckert does a fine job hiding, but the sounds he makes while trying to break out of a locked door give away his location, and it doesn't take long before the gang traces him to a storage area. A security guard manages to trip the alarm and summon the police, but the gang captures Beckert and takes him away just minutes before the police arrive. The only hitch is that they left behind Franz.
The police arrest him and bring him in for questioning. While Franz is initially uncooperative, Inspector Lohmann charges him with a bunk count of accessory to murder, causing Franz to disclose in a fit of panic where the gang has taken Beckert.
The gang takes Beckert to an abandoned distillery where they hold a hasty kangaroo court, complete with a perfunctory defense attorney. The defense attorney claims that Beckert, despite his crime, still has civil rights and therefore deserves a fair trial by the government. The mob, riled up, has none of it. Beckert himself commands attention with a manic diatribe about his total lack of control over himself. He describes himself as a deeply ill man who can not resist the voices that tell him to kill. He blacks out before the murders and comes to with little memory of what he has done.
His ravings and pleas only seem to rile the crowd up more, as they demand his quick execution—the only restitution they will accept for the crimes he has committed. Beckert admonishes them all as people who chose to be criminals, claiming he is different because he cannot control his need to murder. They don't buy it.
The only thing that stops the crowd from lynching Beckert is the entrance of the police.
We close on a judge ruling at Beckert's legitimate court trial, but we never hear the verdict. Instead, we see Elsie's mother lament that nothing the court does will bring the dead children back. All she can offer is that people must take better care of their children.