The immediate cause of the war was the assassination of Archduke Franz Ferdinand of Austria, the heir to the Austro-Hungarian throne, by a Serbian nationalist in Sarajevo (Bosnia) on June 28, 1914.
More profound causes:
1- Growing Russian influence in the Balkans, seen by Austria-Hungary as a threat to its control over Bosnia and Herzegovina, which it had annexed in 1908.
2- Slavic nationalist movements within the Austro-Hungarian Empire that threatened the integrity of the empire.
3- Mutual rivalries among the Great Powers (Germany, Austria-Hungary, Italy, France, Russia, and Great Britain) for influence and power in Europe.
4- Militarism and the arms race among the major European powers, creating a climate of tension and distrust.