the muslims were first required to face jerusalem during prayer , but already during muhammads lifetime this was revised and they were henceforth commanded by the prophet to face the kaaba , an ancient shrine in the city of mecca .