Answer:
First of all there was many causes that acted as a chain
But the immediate cause of World War I that made all the items come into play (alliances,
imperialism, militarism, nationalism) was the assassination of Archduke Franz Ferdinand of Austria-Hungary by the Serbian nationalist Gavrilo Princip