Though Prophet Muhammad used to offer prayers while facing Jerusalem in Mecca, he would also face the Ka`bah in the same direction as Jerusalem. However, when he immigrated to Medina, he could no longer face the Ka`bah and Jerusalem at the same time, which aggravated Prophet Muhammad’s feelings of sadness, pain, and agony driven by homesickness and estrangement.