The Triple Alliance was a diplomatic and military agreement between the leaders of Germany, Austria-Hungary, and Italy that lasted from 1882 until the beginning of World War I, in 1914.
Germany and Austria-Hungary had been part of the Three Emperors' League, formed in 1872, along with Russia. The three emperors were Russian Tsar Alexander II, German Kaiser Wilhelm I, and Austro-Hungarian Emperor Franz Josef. That arrangement disintegrated because Austria-Hungary and Russia came to be at odds over the expansionary intentions of both countries, which overlapped in the Balkans.
Germany and Austria-Hungary formed a secret alliance and then added Italy, on May 20, 1882. This Triple Alliance joined three relatively new countries (Austria-Hungary formed in 1867 and German and Italy unified in 1871) in a pact of defense and cooperation.
In an effort to extend its borders and influence, Austria-Hungary occupied Bosnia-Herzegovina in 1878. (This occupation lasted 30 years, until formal annexation in 1908.) About the same time, a nearby dispute between Russia and Turkey over control of Serbia led to the Russo-Turkish War. Serbia gained its independence as a result of this conflict, and Russia pledged its support to the strong, newly independent country.
Serbia expanded its influence in the Balkans, gaining territory and wealth during the First and Second Balkan Wars (1912-1913). Austria-Hungary's annexation of Bosnia-Herzegovina troubled both Serbia and Russia. Tensions rose to a fever pitch with the assassination of Archduke Franz Ferdinand, the heir to the Austro-Hungarian throne. In response, Austria-Hungary gave Serbia a 10-point ultimatum, to which Serbia agreed on all but one point. Austria-Hungary declared war on Serbia, and Russia declared on Austria-Hungary. Emperor Franz Josef called on Germany to live up to its responsibilities under the Triple Alliance, and Germany declared war on Russia. Italy went along with its allies for awhile but then switched sides, allying itself with the members of the Triple Entente.
The remainder of the defunct Triple Alliance, Germany and Austria-Hungary, formed the Central Powers, along with Bulgaria and the Ottoman Empire. The end of World War I came with the surrender of these powers.