In 623 C.E. the Holy Prophet decided to build a mosque in Madina which was to be a prayer house as well as a community center. The Holy Prophet asked the Muslims to offer their services in labor as well as capital towards the construction of the mosque. Ali was the first person to offer his services as laborer. He shoveled the earth when the foundations were being laid and later carried on baskets of brick and mortar which he passed on to the masons. Ali composed some verses for the occasion, and he recited them as he worked as a laborer. Some of these verses which have been preserved are: "Whoever builds a mosque and works whether sitting or standing puts up with the pain of labor, while others shirk work for fear of dust and pain. Both of these verily cannot equal each other". As the other Muslims labored they chanted: "There is no life but the life of the next world, O God have mercy on the Muhajireen and the Ansar". Within a few months the mosque was completed. It was square in form, and each side measured fifty yards. The mosque faced towards the north, and had three gates on each of the remaining three sides. Adjoining the mosque apartments were constructed for the household of the Holy Prophet. Ali also had an apartment in the mosque. The mosque was a monument of simplicity. The walls were made of mud bricks and the roofs were supported by trunks of palm trees. The apartments for the household were hung with blankets of camel hair as doors. The courtyard in each case was hardly six to seven paces in length, and the length of the rooms did not extend ten paces.