With the approach of the Second World War, Somerville was recalled to duty on special service to the Admiralty later in 1939 and performed important work on naval radar development.
In May 1940, Somerville served under Admiral Sir Bertram Ramsay, helping organize the Dunkirk evacuation.
His next major assignment was as commander of the newly formed Force H based in Gibraltar, with his flag in the battlecruiser HMS Hood.
After the French armistice with Germany on 22 June 1940, Winston Churchill gave Somerville and Force H the task of neutralizing the main element of the French battle fleet, then at Mers El Kébir in Algeria.
They were to attack and destroy the French ships if all other options failed.
Churchill wrote to him:
You are charged with one of the most disagreeable tasks that a British Admiral has ever been faced with, but we have complete confidence in you and rely on you to carry it out relentlessly.

Although Somerville privately  felt that such an attack would be a mistake, he carried out his orders.
The French refused to comply with British conditions and so on 3 July 1940, Force H attacked French ships at Mers-el-Kébir.
Somerville's forces inflicted severe damage on their erstwhile allies, most notably sinking the battleship Bretagne with heavy loss of life.
Several other major French ships were damaged during the bombardment.
The operation was judged a success, but he admitted privately to his wife that he had not been quite as aggressive in the destruction as he could have been.
He was Mentioned in Despatches on 16 August 1940.

Somerville transferred his flag to the battlecruiser HMS Renown in August 1940 and led the British forces in the Battle of Cape Spartivento in November; Churchill was outraged at Somerville for not continuing the pursuit of the Italian Navy after that battle and dispatched Earl of Cork and Orrery to conduct an inquiry, but Cork found that Somerville had acted entirely appropriately.
Force H bombarded Genoa on 9 February 1941, and, after Somerville had transferred his flag to the aircraft carrier HMS Ark Royal in May 1941, also played an important role in the pursuit and sinking of the German battleship Bismarck later that month.
Somerville transferred his flag to the battleship HMS Nelson in August 1941 and also played a major role in protecting Malta from enemy attack in autumn 1941.
He transferred his flag to the battleship HMS Rodney and then to the battleship HMS Malaya.
He was appointed a Knight Commander of the Order of the British Empire for his service with Force H on 21 October 1941.
With the approach of the Second World War, Somerville was recalled to duty on special service to the Admiralty later in 1939 and performed important work on naval radar development. In May 1940, Somerville served under Admiral Sir Bertram Ramsay, helping organize the Dunkirk evacuation. His next major assignment was as commander of the newly formed Force H based in Gibraltar, with his flag in the battlecruiser HMS Hood. After the French armistice with Germany on 22 June 1940, Winston Churchill gave Somerville and Force H the task of neutralizing the main element of the French battle fleet, then at Mers El Kébir in Algeria. They were to attack and destroy the French ships if all other options failed. Churchill wrote to him:
You are charged with one of the most disagreeable tasks that a British Admiral has ever been faced with, but we have complete confidence in you and rely on you to carry it out relentlessly.
Although Somerville privately  felt that such an attack would be a mistake, he carried out his orders. The French refused to comply with British conditions and so on 3 July 1940, Force H attacked French ships at Mers-el-Kébir. Somerville's forces inflicted severe damage on their erstwhile allies, most notably sinking the battleship Bretagne with heavy loss of life. Several other major French ships were damaged during the bombardment. The operation was judged a success, but he admitted privately to his wife that he had not been quite as aggressive in the destruction as he could have been. He was Mentioned in Despatches on 16 August 1940.
Somerville transferred his flag to the battlecruiser HMS Renown in August 1940 and led the British forces in the Battle of Cape Spartivento in November; Churchill was outraged at Somerville for not continuing the pursuit of the Italian Navy after that battle and dispatched Earl of Cork and Orrery to conduct an inquiry, but Cork found that Somerville had acted entirely appropriately. Force H bombarded Genoa on 9 February 1941, and, after Somerville had transferred his flag to the aircraft carrier HMS Ark Royal in May 1941, also played an important role in the pursuit and sinking of the German battleship Bismarck later that month. Somerville transferred his flag to the battleship HMS Nelson in August 1941 and also played a major role in protecting Malta from enemy attack in autumn 1941. He transferred his flag to the battleship HMS Rodney and then to the battleship HMS Malaya. He was appointed a Knight Commander of the Order of the British Empire for his service with Force H on 21 October 1941.
James Somerville