Ubaidullah had reached Kabul during the war to rally the Afghan Amir Habibullah Khan, and after a brief period there, he offered his support to Raja Mahendra Pratap's plans for revolution in British India with German support. He joined the Provisional Government of India formed in Kabul in December 1915, and remained in Afghanistan until the end of World War I, and then left for Russia. He subsequently spent two years in Turkey and, passing through many countries, eventually reached Hijaz (Saudi Arabia) where he spent about 14 years learning and pondering over the philosophy of Islam especially in the light of Shah Waliullah Dehlawi's works.