In March 1917, Captain Ernst Hardt, Conrad Veidt, a World War I German U-boat commander, is ordered to spy on the British Fleet at Scapa Flow, rendezvousing at the Old Man of Hoy. He sneaks ashore on the Orkney Islands to meet his contact, Fräulein Tiel, Valerie Hobson. Tiel has taken over the identity of a new local schoolteacher, Miss Anne Burnett, June Duprez, whom female German agents had intercepted and chloroformed en route to the island. Hardt finds himself attracted to her, but Tiel shows no interest. The Germans are aided by a disgraced Royal Navy officer, the former Commander Ashington, Sebastian Shaw who, according to Tiel, has agreed to aid the Germans after losing his command due to drunkenness, and Tiel implies that she has slept with Ashington to obtain his cooperation.
The plan is almost disrupted when Burnett's fiancé, Rev. Harris, arrives unexpectedly, but is taken captive; an intrusive local minister and his wife are also deflected away.
Equipped with the crucial information he needs about the British fleet movements, Hardt rendezvous with his submarine to arrange for a fleet of U-boats to attack a sortie of two Royal Navy squadrons. Returning to the house, and confident that all is going according to plan, Hardt makes a romantic overture to Tiel, but, pulling rank, she rebuffs him. She sneaks out of the house, believing she has locked Hardt in his room, but he leaves and secretly follows her, discovering that she has gone out to meet Ashington.
Hardt overhears them talking and learns they are imposters: the British are aware of his presence, and have turned his mission into a trap for the U-boats. As Jill prepares to leave the island, Blacklock returns to arrest Hardt, only to find he has eluded them. Disguised in Rev. Harris's clothes, Hardt manages to board the island ferry, which is also carrying Jill, a number of civilian passengers, and eight German POWs. Blacklock reports Hardt's escape to the base commander, who explains that the British had learned of the Germans' plan when the real Anne Burnett briefly survived the German agents' attempt to kill her by throwing her off an oceanside cliff.
At sea, Hardt manages to free the German prisoners and they seize the ferry. The Royal Navy pursue them, but before it can catch up the ferry is intercepted by Hardt's submarine, and Hardt's first officer, Lieutenant Felix Schuster, Marius Goring decides to shell it. As the U-boat surfaces and prepares to fire, Hardt realises it is his own submarine. He frantically attempts to signal it, but too late – the U-boat shells the ferry, which begins to sink. British ships then arrive and drop depth charges, destroying the fleeing U-boat. As Jill and the other passengers flee in lifeboats, Hardt realises all is lost and chooses to go down with the ship and join his crew.