In 1909, he left Vienna and moved to Sarajevo in Bosnia and Hercegovina, where his brother Karlo worked as a priest. During his stay in Sarajevo, he gradually turned away from his previous militant anti-clericalism, becoming more receptive to Christian spirituality. The same year, he settled in the Rožnik district of Ljubljana. Although he remained an active member of the Yugoslav Social Democratic Party, he rejected the party's view on Yugoslav nation-building: in a resolution in 1909, the party favoured a gradual unification of Slovene culture and language with the Serbo-Croatian ones in order to create a Common Yugoslav cultural nation. Cankar, on the other hand, strongly defended the national and linguistic individuality of Slovenes. Together with Mihajlo Rostohar, he became the most vocal defender of Slovene individuality within a South Slavic political framework. Already after his electoral defeat in 1907, Cankar had started to publish numerous essays explaining his political and aesthetic views and opinions. After his return to Carniola in 1909, he began travelling throughout the Slovene Lands, delivering lectures and conferences. The most famous of these lectures were "The Slovene people and the Slovene culture" (Slovensko ljudstvo in slovenska kultura), delivered in Trieste in 1907, and "Slovenes and Yugoslavs" (Slovenci in Jugoslovani), delivered in Ljubljana in 1913. In the latter, Cankar expressed a favourable opinion on the political unification of all South Slavs, but rejected a cultural merger of South Slavic peoples. Because of the lecture, he was sentenced to one week in prison for defamation of the Austro-Hungarian Monarchy. After the outbreak of World War I in 1914, he was again imprisoned in Ljubljana Castle for supposed pro-Serbian attitudes, but was soon released. In 1917, he was drafted in the Austro-Hungarian Army, but was demobilized due to poor health. In his last lecture, delivered in the National Club of Trieste just after the end of the War, he called for a moral purification and rejuvenation of Slovene politics and culture. He moved from Rožnik to the center of Ljubljana, where he died in December 1918, from pneumonia, a complication of the Spanish Flu pandemic which was raging at the time. His funeral was attended by a huge crowd and highest representatives from the cultural and political life in Slovenia. In 1936, his grave was moved to the Žale cemetery in Ljubljana, where he was buried next to his youth friends and fellow authors Dragotin Kette and Josip Murn.