On the next cruise of TG 22.3, Gallery took the unusual step of forming boarding parties, in case of another chance to capture a U-boat arose.
On June 4, 1944, the task group crossed paths with U-505 off the coast of Africa.
U-505 was spotted running on the surface by two Grumman F4F Wildcat fighters from Guadalcanal.
Her captain, Oberleutnant Harald Lange, dived the boat to avoid the fighters.
But they could see the submerged submarine and vectored destroyers onto her track.
The experienced antisubmarine warfare team laid down patterns of depth charges that shook U-505 up badly, popping relief valves and breaking gaskets, resulting in water sprays in her engine room.
 Based on reports from the engine room, the captain believed his boat to be heavily damaged and ordered the crew to abandon ship, which was done so hastily that full scuttling measures were not completed.

Gallery ordered the boarding party from the destroyer escort USS Pillsbury to board the foundering submarine and if possible capture her.
The destroyers in range used their .50 caliber and 20 mm antiaircraft guns to chase the Germans off the vessel so the boarding party could get onto her.
Once on board, the party replaced the cover of the sea strainer, thus keeping the U-boat from sinking immediately.
The boarders retrieved the submarine's Enigma coding machine and code books. (
This was a primary goal of the mission because it would enable the codebreakers in Tenth Fleet to read German signals immediately, without having to break the codes).
They got her under control, and U-505 became the first foreign man-of-war captured in battle on the high seas by the U.S. Navy since the War of 1812.

This incident was the last time that the order "Away All Boarders!"
was given by a U.S. Navy captain.
Lieutenant Albert David, who led the boarding party, received the Medal of Honor for his courage in boarding a foundering submarine that presumably had scuttling charges set to explode – the only Medal of Honor awarded in the Atlantic Fleet during World War II.
For capturing U-505, Task Group 22.3 was awarded the Presidential Unit Citation and Gallery received the Distinguished Service Medal.

He also received a blistering dressing-down from Admiral Ernest J. King, Chief of Naval Operations.
King pointed out that unless U-505's capture could be kept an absolute secret, the Germans would change their codes and change out the cipher wheels in the Enigma.
Gallery managed to impress his crews with the vital importance of maintaining silence on the best sea story any of them would ever see.
His success kept him from getting a court-martial instead of a medal. (
Two noted naval historians, Samuel Eliot Morison and Clay Blair, Jr., take opposite views of Gallery's case.
Morison saw it as an intrepid act of combat valor in the finest Navy tradition; Blair sided with Admiral King and called it an act of lunacy which could have undone all the work done by the codebreakers on both sides of the Atlantic.)
After the war, King personally approved the award of the Presidential Unit Citation to Task Group 22.3 for the capture of the U-boat.
On the next cruise of TG 22.3, Gallery took the unusual step of forming boarding parties, in case of another chance to capture a U-boat arose. On June 4, 1944, the task group crossed paths with U-505 off the coast of Africa. U-505 was spotted running on the surface by two Grumman F4F Wildcat fighters from Guadalcanal. Her captain, Oberleutnant Harald Lange, dived the boat to avoid the fighters. But they could see the submerged submarine and vectored destroyers onto her track. The experienced antisubmarine warfare team laid down patterns of depth charges that shook U-505 up badly, popping relief valves and breaking gaskets, resulting in water sprays in her engine room.  Based on reports from the engine room, the captain believed his boat to be heavily damaged and ordered the crew to abandon ship, which was done so hastily that full scuttling measures were not completed.
Gallery ordered the boarding party from the destroyer escort USS Pillsbury to board the foundering submarine and if possible capture her. The destroyers in range used their .50 caliber and 20 mm antiaircraft guns to chase the Germans off the vessel so the boarding party could get onto her. Once on board, the party replaced the cover of the sea strainer, thus keeping the U-boat from sinking immediately. The boarders retrieved the submarine's Enigma coding machine and code books. (This was a primary goal of the mission because it would enable the codebreakers in Tenth Fleet to read German signals immediately, without having to break the codes). They got her under control, and U-505 became the first foreign man-of-war captured in battle on the high seas by the U.S. Navy since the War of 1812.
This incident was the last time that the order "Away All Boarders!" was given by a U.S. Navy captain. Lieutenant Albert David, who led the boarding party, received the Medal of Honor for his courage in boarding a foundering submarine that presumably had scuttling charges set to explode – the only Medal of Honor awarded in the Atlantic Fleet during World War II. For capturing U-505, Task Group 22.3 was awarded the Presidential Unit Citation and Gallery received the Distinguished Service Medal.
He also received a blistering dressing-down from Admiral Ernest J. King, Chief of Naval Operations. King pointed out that unless U-505's capture could be kept an absolute secret, the Germans would change their codes and change out the cipher wheels in the Enigma. Gallery managed to impress his crews with the vital importance of maintaining silence on the best sea story any of them would ever see. His success kept him from getting a court-martial instead of a medal. (Two noted naval historians, Samuel Eliot Morison and Clay Blair, Jr., take opposite views of Gallery's case. Morison saw it as an intrepid act of combat valor in the finest Navy tradition; Blair sided with Admiral King and called it an act of lunacy which could have undone all the work done by the codebreakers on both sides of the Atlantic.) After the war, King personally approved the award of the Presidential Unit Citation to Task Group 22.3 for the capture of the U-boat.
Daniel V. Gallery