Andrić's literary career began in 1911, and prior to the outbreak of World War I, he published a number of poems, essays and reviews, and also translated the works of foreign writers. In the years leading up to the war, he joined a number of South Slav student movements calling for an end to the Austro-Hungarian occupation of Bosnia and Herzegovina. He was also a close friend of Princip. In late July or early August 1914, Andrić was arrested by the Austro-Hungarians for his connections to Franz Ferdinand's assassins. He spent much of World War I in captivity, and was only freed in July 1917, after Emperor Charles declared a general amnesty for political prisoners. In 1920, Andrić entered the diplomatic service of the newly created Kingdom of Serbs, Croats and Slovenes (later renamed Yugoslavia) He published a short story titled "The Bridge on the Žepa", which was to serve as a prototype for the "Bridge on the Drina", in 1925. In 1939, he was appointed as Yugoslavia's ambassador to Germany, which went on to spearhead an invasion of his country in April 1941, within the wider context of World War II. Andrić and his staff were arrested by the Germans following the invasion. In June 1941, he was permitted to return to Belgrade. Andrić was retired from the diplomatic service and confined to a friend's apartment by the Germans, living in conditions that some biographers have likened to house arrest. Over the following three years, he focused on his writing and pondered over the disintegration of Yugoslavia, which had become the scene of a brutal inter-ethnic civil war following the invasion.