Despite its significance, emigration is a difficult undertaking. When the Muslims resettle in Madina after years of persecution, they were destitute. Moreover, some were extremely poor, and others, who had earned their lives by trade, had no capital. The Muslims of Madina were mostly farmers, and the city's commercial life was controlled by Jews. Another serious problem was that just before the Messenger's arrival, the Madinans had decided to make 'Abd Allah ibn Ubayy ibn Salul their chief. This plan naturally was abandoned, which made him a bitter enemy of the Messenger and an important foe. The Makkan polytheists still wanted to defeat the Prophet, and worked with him to achieve their goal. He told them: "Don't worry if he spreads Islam here. The main danger is that he might ally with the Christians and Jews against paganism. That is the real threat."
After he settled in Madina, the Messenger helped his people build a mosque. The importance of the mosque for the Muslim community's collective life is unquestionable. They meet there five times a day and, in the Presence of God, their Master, Creator, and Sustainer, increase in belief and submission to Him, the Prophet and Islam, and strengthen their solidarity. Especially in the first centuries of Islam, mosques functioned as places of worship and as centers of learning. The Prophet's Mosque in Madina was, in the time of the Prophet himself and his immediate political successors, also the center of government.
Immediately after settling in Madina, the Messenger established brotherhood between Muslims, particularly between the Emigrants and the Helpers. They became very close to each other. For example, Sa'd ibn Rabi' took his Emigrant "brother" 'Abd al-Rahman ibn 'Awf home and said: "Brother, you have left everything in Makka. This house, with everything in it, belongs to both of us. You don't have a wife here; I have two. Whichever of them you like, I'll divorce her so that you may marry her." 'Abd al-Rahman answered him in tears: "Brother, may God bless you with your wife! Please show me to the city bazaar so that I may do some business." 
This brotherhood was so deep, sincere, and strong that the Helpers shared everything with the Emigrants. This lasted for some time. However, when the Emigrants had become accustomed to their new environment, one day they asked the Messenger: "O Messenger of God. We emigrated here purely for the sake of God. But our Helper brothers are so good to us that we fear we will consume in this world the reward of our good deeds, which we expect to get in the Hereafter. Also, we feel very indebted to them. Please ask them to let us earn our own living."
The Messenger sent for the Helpers and told them of the situation. The Helpers unanimously objected, finding it unbearable to be separated from their brothers. In the end, to spare the Emigrants' feeling of indebtedness, the Helpers agreed that the Emigrants would work in their fields and gardens in return for wages until they could build their own houses. 
As a second step in solving immediate problems, the Messenger signed a pact with the Jewish community in Madina. This document, which some scholars describe as Madina's first constitution, confederated the Muslims and Jews as two separate, independent communities.  Since the Messenger took the initiative in making this pact and acted as the final arbiter in all disputes, Madina came under Muslim control.
To guarantee Muslims' security within this city-state, the Messenger ordered the establishment of a new bazaar. Until then, Madina's economic life had been controlled by the Jewish community. After this, Jewish economic domination began to decline, for they no longer monopolized Madina's commerce.
While the Muslim community was establishing itself and growing in strength, it was forced to respond to internal and external attacks. After their victory of Badr, the Muslims fought the Makkans again at the foot of Mount Uhud. Their easy victory during the battle's first part was followed, unfortunately, by a reverse when the archers' disregarded the Prophet's instructions. Seventy Muslims were martyred, and the Messenger was wounded. The Muslim army took shelter on the mountain and prepared to fight back. Lacking enough courage for a further attack, the Makkan forces left. Nevertheless, they changed their mind halfway and decided to march upon Madina. Informed of this, the Messenger mobilized his troops. A single order was enough to accomplish this, even though they were ill or wounded. His every call was a breath of life for their souls, a breath that could revive old, rotten bones. Busiri says:
Were his value and greatness to be demonstrated by miracles,
The bones that have rotted away were revived by calling his name.
The half-crushed army set out to counter the enemy. Almost everyone was wounded, but no one wanted to stay behind. In describing the situation, one Companion said: "Some Companions couldn't walk. They said: 'We want to be present at the front where the Messenger has ordered us to go. Even if we cannot fight, we will stand there with spears in our hands.' They were carried on other people's shoulders or backs." Seeing the Muslim army marching toward them, Abu Sufyan ordered his troops to return to Makka. In praising those heroes of Islam, the Qur'an says: Those to whom the people said: "The people have gathered against you, therefore fear them"; but it increased them in faith, and they said: "God is sufficient for us; an excellent Guardian is He" (3:173). 
 Bukhari, "Hiba," 35; Muslim, "Jihad," 70.
 Ibn Hisham, 2:147.
 Bukhari, "Maghazi," 25; Ibn Sa'd, 2:42–9; Ibn Hisham, 3:99-111, 128.