Luigi Mascherpa was born in Genoa in 1893 and entered the Naval Academy in Livorno in 1911. After graduating as a midshipman in 1914, he became a floatplane pilot at the start of World War I (serving with the seaplane tender Europa) and was promoted to Sub-Lieutenant in 1916. Later in the war he joined the armoured cruiser San Giorgio where he was promoted to Lieutenant and became navigation officer and aide of the Italian naval commander in Albania. In October 1918 he participated in the Battle of Durazzo, where he was awarded a Silver Medal of Military Valor.
He also took part in the Italian occupation of Albania, as part of the crew of the scout cruiser Alessandro Poerio. He later served on board the battleship Roma and the scout cruiser Guglielmo Pepe, and in 1923-1924 he became commander of the gunboat Giuliana and later of the escort gunboat Tolosetto Farinati. Afterwards he served on the destroyer Fuciliere and then became a MAS squadron leader. In 1926 Mascherpa was promoted to Lieutenant Commander and given command of the San Marco Battalion; in 1931, after promotion to Commander, he served on board the battleship Duilio and then became Chief of Staff of the Pola Naval Command. During the Italo-Ethiopian War he commanded auxiliary ships and was then appointed commander of the Aegean MAS Group; at the end of 1936 he was appointed executive officer at the Taranto Naval Barracks.
Mascherpa remained in his office in Taranto during the earlier part of World War II; promoted to Captain in 1941, in April 1942 he was appointed military commander of the island of Leros, the main naval base in the Italian Dodecanese, and of the nearby islands. Life in Leros was relatively uneventful during the war against the Allies, but after the September 1943 armistice between Italy and the Allies, the Wehrmacht launched a campaign to invade and occupy the Dodecanese. After the fall of Rhodes, he assumed command of all Italian naval forces in the Dodecanese; on 13 September, the Germans offered Mascherpa to surrender with "honourable conditions", but he refused.
As the commander of Leros, Mascherpa led the resistance of the Italian forces stationed in the island. Mascherpa had about 8,320 men at his orders, three quarters of them belonging to the Regia Marina, but only about one thousand of them were first-line troops, while the others mainly belonged to technical and service units and to the anti-aircraft defence. There were three coastal batteries armed with 152 mm guns, two with 120 mm guns, four with 102 mm guns, one with 90 mm guns and 14 with 76 mm guns, while the anti-aircraft defense had fourteen 102 mm guns, six 90 mm guns, thirty-eight 76 mm guns, three 37 mm machine guns, fifteen 20 mm machine guns and thirty-one 13,2 mm machine guns. At Mascherpa’s disposal were also the destroyer Euro, two motor torpedo boats, six MAS, two minelayers and several auxiliary minesweepers and other smaller vessels; the only aircraft available were seven CANT Z. 501 which however were soon destroyed by the Luftwaffe or transferred to Leipsoi.
Soon after the armistice, Mascherpa re-organized the anti-aircraft defense and persuaded the British commands to allow his ships to stay in Leros (instead of having to reach Malta like the rest of the Italian fleet), since they would be of more use there, in case of likely German attack. On 12 September, a delegation of British officers met Mascherpa to verify the island's defenses and to inquire about what relations would be established between Italian and British troops; Mascherpa did not go too far in his replies, since the terms of the armistice were still rather vague. On the following day, more British officers arrived, including Major George Jellicoe and colonel Turbull, who was disappointed by the state of the defences, especially the anti-aircraft ones. Meanwhile, it has been decided to shoot at any German plane that would fly over Leros. The first of about 3,000 British soldiers sent as a reinforcement started to land on Leros on 15 September; since it was announced that a British general (Major-General F. G. R. Brittorous) would be sent as well, Mascherpa required Supermarina (the Royal Italian Navy command) to be advanced to Rear Admiral, so that he would not be junior in rank to Brittorous. On 20 September, when Brittorous landed along with 600 more men, Supermarina consented and promoted Mascherpa to Rear Admiral.
Frictions between the two commanders soon began, when Brittorous published proclamations where the British forces were referred to as "occupiers"; Mascherpa's protests led to change in the text of the proclamations, and he was confirmed in command of all Italian forces in Leros as well as of the civilian population, but subordinated to Brittorous. Both officers asked their commands for reinforcements, food and ammunitions, but little arrived. On 26 September, after days of dropping threatening leaflets, the Luftwaffe started bombing the island.
Between 26 September and 11 November Leros was continuously subjected to heavy bombings (an average of four air strikes and 41 bombers per day between 26 and 30 September, and eight air strikes and 37 bombers daily between 7 October and 11 November), which sank the destroyer Euro, the minelayer Legnano, the Greek destroyer Vasilissa Olga, the British destroyer Intrepid and several smaller units and auxiliary and merchant vessels. The submarine base, the barracks of the naval base, the workshops, four of the five fuel depots and the airport were destroyed, as well as the villages and towns, especially Leros and Lakki. 10% of coastal batteries, 30% of anti-torpedo boat batteries and 20% of anti-aircraft guns were destroyed; hospitals had to be transferred in caves. Several German planes were shot down. Despite resupply attempts with submarines, destroyers and aircraft, ammunitions were scarce, whereas food and medicines would last for many months.
On 5 November, Brittorous was replaced by Brigadier Robert Tilney. Mascherpa was not forewarded of the substitution; he was asked to go to Cairo to discuss the situation of the island, but he refused, fearing that he would not be allowed to go back to Leros to lead the defense. Relations between Mascherpa and Tilney were tense from the beginning; upon arrival, Tilney denied the Italian forces any possibility of initiative or counterattack, relegating them to merely defensive tasks, and put each sector of the defense under a British colonel. The British even asked for Mascherpa to be substituted, and Supermarina decided to replace him with Captain Dairetti, but this was never carried out due to subsequent events. On the morning of 12 November, German landings commenced: one attempt was repelled by the Italian coastal batteries, but another landing succeeded, and by noon the Germans (also supported by Luftwaffe) had secured some bridgeheads. Later in the day, 600 Fallschirmjägers were launched over the island; half of them were killed or wounded before to land, but the survivors managed to capture some Italian positions, while the Italian coastal batteries repelled another landing attempt and sank a few landing crafts. That night, Mascherpa proposed a counterattack and Tilney approved, but the British troops assigned to this task were exhausted after a day of fighting, and were thus unable to carry out the order.
On 13 November, HMS Dulverton was sunk by Luftwaffe while trying to resupply the garrison, and a new launch of German paratroopers, though meeting stiff resistance and suffering heavy losses, was able to capture some more Italian batteries. Mascherpa asked general Mario Soldarelli in Samos for reinforcements and air cover, but in vain. On the night of 14 November, British forces recaptured some batteries and positions and, supported by Italian artillery, prevented the Fallschirmjägers from rejoin the German landing troops; new German attacks, later in the day, however, led to the capture of Alinda Bay, Grifo Bay, Mount Clidi, Mount Vedetta and Mout Appetici. On the night between 14 and 15 November the German forces invaded the town of Leros and the villages of Alinda and Santa Marina, while British destroyers landed 500 more men a Lakki, shelled German positions and sank some German landing crafts. On 15 November, upon strong insistence from Mascherpa, Tilney finally ordered a counterattack, but it was too late to change the situation; since his suggestions went unheeded, Mascherpa left the headquarters and went to the Naval Command.
By then, Leros was effectively cut in two by the German forces, which received further reinforcements with new landings. In the morning of 16 November, renewed German attacks were repelled by the British forces led by Tilney; the German commander sent to Mascherpa an offer to separately surrender his Italian forces, promising that all his men would have been spared in this case, but Mascherpa refused. At 16:00 on the same day the defenders of the island were completely surrounded, and Tilney decided to surrender. Mascherpa still resisted with his men, but after reiterated requests, even by Tilney, he was persuaded to surrender at 22:00. He was interrogated and then dictated to order all his forces to surrender (some Italian units were still resisting, and kept fighting till the following day), but before being able to do so he was locked in a house and left there for some days without food.
On 21 November Mascherpa was shipped to mainland Greece and then sent to the Schokken prisoner-of-war camp in Poland, but later he was handed over to the RSI authorities, which imprisoned him in a jail in Verona and then in San Francesco jail in Parma. During a bombing on the city, on 13 May 1944, the jail was hit and damaged, and several prisoners escaped; Mascherpa, however, refused to flee. On 22 May 1944 Mascherpa was tried by a Fascist kangaroo court ("Tribunale Speciale per la Difesa dello Stato"), along with admiral Inigo Campioni (the governor of the Dodecanese), on charges of "treason" for having resisted the German invasion. While returning to jail during a pause in the trial, their car found itself in the middle of an air alarm and a young officer of the escort proposed to them to take advantage of the chaos and flee, but Mascherpa and Campioni refused, not wanting to compromise their escort and stating that their consciences were clear. Both Mascherpa and Campioni were judged "guilty" and sentenced to death by execution by firing squad on the same day; on 24 May 1944, after shouting "Long live Italy" in front of the firing squad, the two admirals were shot in Parma. Both were posthumously awarded the Gold Medal of Military Valor.