The interaction between domestic affairs and the Monarchy's foreign policy was potentially fateful. The Ausgleich enabled the Monarchy to function as a great power, but it also fundamentally weakened it. Financially the fixed nature of contributions to common expenditure, and the requirement every 10 years to renegotiate this, limited the size of the armed forces and raised doubts as to their efficacy. The multinational composition of the Monarchy made it peculiarly vulnerable to certain pressures, both internal and external, and apprehensive about these; the chronic conflict between nationalities advertised this weakness. Finally, the direction of foreign policy was subtly affected by the fact of the Ausgleich itself. Francis Joseph's control of foreign affairs was effectively absolute but, by the terms of the Ausgleich, the Austrian and Hungarian ministers-president had a right to be consulted on foreign policy. The Hungarians, if not the Austrians, availed themselves of this right, especially in the early period, with the consequence that policy towards Russia and the Balkans assumed a more readily Russophobe hue than it might otherwise have done. Hungarians were well represented in the diplomatic service and one, Andrassy, was foreign minister for most of the crucial 1870s.
Certain abiding features of Austro-Hungarian foreign policy emerged at an early stage. Given the prevailing suspicion of Russia's intentions, and despite recurrent attempts at conservative solidarity with the tsars as well as Germany, Francis Joseph at Andrassy's urging eventually gravitated towards a formal alliance with the German Empire in 1879. The German alliance remained a constant down to 1918, since in the eyes of the emperor and successive ministers Germany was the essential safeguard against Russia, even though
Germany's own diplomacy, after 1890, became increasingly adventurous and alarming to other powers.
The Monarchy also sought to avert the threat of irredentist nationalism by cultivating the monarchical, conservative elements in all three of its potential enemies to the south, concluding alliances with Serbia, Italy and Romania in the 1880s. This was only a limited success. Italy and Romania stayed allies until the outbreak of the First World War, but were never seen as trustworthy by Vienna, and indeed ended by joining the opposite side. In the case of Serbia a series of treaties was forced on the country in 1880—1, designed to keep it in a state of political and economic subjection. Serbia's rulers undertook not to conclude alliances with other states without Vienna's consent, and its principal export, livestock, was made entirely dependent on the Austro-Hungarian market. This policy backfired disastrously after 1903, however, when a palace revolution in Belgrade brought to power a new dynasty and a more stridently nationalist government, determined to emancipate Serbia from its subordinate position.
In 1878—9, before any of these ties of doubtful value had been forged, the Monarchy took the ultimately self-defeating step of occupying the Ottoman province of Bosnia—Hercegovina. Andrassy agreed with Francis Joseph, who needed no persuading, that this first acquisition (rather than loss) of territory of the reign was vital for strategic reasons, but above all to prevent the aggrandisement of Serbia, whose attractive power over the Monarchy's own Serbs would otherwise be strengthened. The Monarchy thus assumed control over a mixed population of Orthodox Serbs, Catholic Croats and Muslim Slavs, possession of which earned it the implacable hatred of Serb nationalists on both sides of the frontier. Bosnia was a constitutional anomaly, administered by the common finance minister because neither the Austrian nor the Hungarian government wished to see it in the hands of the other, and for the next 40 years a succession of able bureaucrats strove to make it a showcase for Habsburg rule, establishing a secure and efficient government and considerable economic modernisation. Yet the basic contradiction remained: although Croats accepted Habsburg rule readily, and Muslim landowners did likewise in return for security of tenure, the Serbs persisted in dreaming of union with Serbia and were increasingly seen as internal enemies by the Habsburg authorities.11
The Bosnian question was at the root of the downward spiral in the Monarchy's international security after 1903. Resentment at the occupation of the province had contributed to the nationalist backlash in Serbia, which produced the revolution of that year, and once the new regime in Belgrade had dared to break off economic relations with the Monarchy in the so-called 'Pig War' of 1906—11, when the Monarchy closed its borders to Serbian livestock and Serbia was forced to find alternative markets elsewhere, the inherent antagonism between Austria-Hungary and Serbia could only escalate. Formal annexation of Bosnia in 1908, and the unsuccessful prosecution of South Slav politicians within the Monarchy for treasonable dealings with Serbia during the crisis, only made matters worse. The Balkan Wars of 1912—13 completed the deterioration in the Monarchy's perceived strategic position: a strengthened Serbia, perhaps this time with Russian backing, appeared to enjoy increased prestige as the potential 'Piedmont' or unifier of the South Slavs. What has sometimes been described as the militarisation of Habsburg decision-making, with both civilian and military leaders resolved somehow 'to eliminate Serbia as a political power-factor in the Balkans', was already a reality by June 1914.12 It was at this point that the assassination at Sarajevo of Francis Joseph's heir, Archduke Francis Ferdinand, by a Bosnian Serb mistakenly assumed to be acting at Belgrade's behest, offered what seemed the ideal pretext for war against Serbia.