The establishment of the Babadan Mosque, one of the Pathok Negoro (Negative Path) in Ngayogyokarto Hadiningrat, is inseparable from the role of Kyai Nur Iman, also known as BPH Sandiyo, the son of Susuhunan Amangkurat Jawi/Amangkurat IV, who ruled the Kartosuro Palace around 1719-1726.
During the civil war, BPH Sandiyo, or Kyai Nur Iman, decided to leave the palace fortress with his two close friends, Sanusi and Tanmisani.
He preached to spread Islam and instilled a sense of patriotism, inciting hatred among the people against the colonialists, namely the Dutch East India Company.