were transferred to Trieste to serve as guard ships against Italian commando raids. Each ship was fitted with a anti-aircraft gun after their arrival on 26 August to counter intense Italian air attacks. Wien was damaged by a near miss on 5 September, and both ships withdrew to Pola on 12 September. They returned to Trieste on 30 October and sortied into the Gulf of Trieste on 16 November to attack Italian coastal defenses at Cortellazzo, near the mouth of the Piave River. Budapest and Wien opened fire at 10:35 at a range of about and knocked out most of the Italian guns after about a half-hour. Their bombardment was interrupted by several unsuccessful Italian air attacks before a more coordinated attack was made by five MAS torpedo boats and five aircraft around 13:30. This was also unsuccessful, and the last Italian coast defense gun was knocked out an hour later. The ships had sustained only minor damage from several hits and near-misses, and not a single sailor was wounded. Emperor Karl inspected Budapest on 19 November at Trieste. Anxious to revenge themselves against the Austro-Hungarians, the Royal Italian Navy (Regia Marina) planned an attack on the two ships in their berths in the Bay of Muggia, near Trieste, by MAS boats. On the night of 9/10 December, two MAS boats managed to penetrate the harbor defenses undetected, and fired torpedoes at Wien and Budapest. The torpedoes fired at the Budapest struck the mole of the seaplane station, but Wien was hit twice and capsized in five minutes, killing 46 of the crew. Budapest was scheduled for a shore bombardment on 12 December, but was postponed for a week by bad weather. Escorted by the light cruiser , six destroyers, nine torpedo boats and a dozen minesweepers, Budapest and the pre-dreadnought bombarded the Castellazzo fortifications on 19 December. The ship transferred to Pola two days later, and she was decommissioned on 11 March 1918. She became the accommodation ship for the submarine staff (Wohnschiff der U-Bootleitung). Just over a week later, Admiral Franz von Keil proposed that a 38-centimeter siege howitzer be installed to bombard the Castellazzo fortifications. Little time was wasted, and removal of the forward gun turret and its barbette began on 26 March. The installation of the gun was completed on 4 April although testing did not begin until 5 June when three shots were fired. The