Ehrlich remained there for the rest of his teaching career and was Rector of the University in 1906-7. During the turmoil of World War I, when Czernowitz was occupied several times by Russian forces, he moved to Switzerland. After the break-up of the Austro-Hungarian Empire and the ceding of the Bukovina to Romania, Ehrlich planned to return to Czernowitz, where he would have been required to teach in Romanian, but he died of diabetes in Vienna, Austria in 1922.