The Bosnian Crisis of 1908 and two Balkan Wars of 1912-1913 had heightened animosity between Russia and Austria-Hungary, the latter backed by its German ally.
On June 28, 1914, Archduke Franz Ferdinand, heir to the Austro-Hungarian throne, was assassinated in Sarajevo, the capital of Bosnia-Herzegovina (now part of Bosnia and Herzegovina), a province of Austria-Hungary. The assassin was Gavrilo Princip, a Bosnian Serb and member of the Black Hand, a Serbian nationalist secret society.
Austria-Hungary issued an ultimatum to Serbia, demanding that it punish those responsible for the assassination and take measures to prevent such incidents in the future. Serbia agreed to most of the demands but rejected some, and Austria-Hungary declared war on Serbia on July 28, 1914.
Russia, as the protector of Serbia, began to mobilize its army and was joined by France, its ally. Germany, in support of Austria-Hungary, declared war on Russia and France, and on August 1, 1914, it invaded France through Belgium, bringing Great Britain into the war.
Thus, the assassination of Archduke Franz Ferdinand was the immediate trigger that set off a chain of events that led to the outbreak of World War I.