After Muhammad began to preach openly, more than a decade passed. During this time, opposition from the pagans reached such a level that, fearing for the lives of their followers, the Prophet decided to send some of them to Ethiopia. Her ruler, being a Christian, nevertheless agreed to take the immigrants to their special protection. The Muslims keep the good memory of this deed until now. But in Mecca the believers were being persecuted more and more.
Followers of Muhammad were subjected to bullying, violence and even torture. Finally, the time came when seventy of the Prophet's companions left on his orders to the city of Yathrib in the hope that this would be a new step in the spread of Islam. This city was later renamed Medina (which means "city"). Later, in the early autumn of 622, Muhammad joins the settlers with his closest friend and associate Abu Bakr Al-Siddyk. This event coincided with the conspiracy of the Meccan leaders for his murder.
In Mecca, the conspirators came to Muhammad's house and found only his cousin Ali sleeping in the bed of the Prophet. Enraged Meccans appointed a large ransom for Muhammad's head and went after him. However, Muhammad and Abu Bakr took refuge in the cave. By the will of Allah, the pagans did not notice them, and Muhammad and Abu Bakr continued on their way to Medina. There they were joyfully greeted by crowds of citizens, as well as Meccans who had moved here earlier to prepare everything.
This is a brief description of the Hijra, an important milestone in the history of Islam. Usually this word is translated as "resettlement", but this is not an exact translation. In reality, this was not just a resettlement, but a carefully planned migration, which marks not only a turning point in history - the beginning of the Islamic faith, but also a new way of life for Muhammad and all Muslims. From now on, the main organizational principle of the Islamic community is not just a blood relationship, but also the brotherhood of all Muslims. People who accompanied Muhammad during the Hijra began to be called Muhajirs - "those who committed the Hijra" or "settlers", and in Medina they accepted Islam and became Muslims, they were called "Ansara", or "helpers".
Muhammad was well aware of the situation in Medina. Earlier, before the Hijra, an annual pilgrimage was made to Mecca, and the Prophet used this time to call pilgrims to Islam. Thus, a group of Medina residents heard his call and accepted Islam. They, in turn, suggested that Muhammad move to Medina. After the Hijra, the exceptional qualities of Muhammad impressed the inhabitants of Medina so much that previously warring tribes and their allies rallied, when on March 15, 624, Muhammad and his supporters opposed the Gentiles of Mecca.
The first battle, which took place near the town of Badr, now a small town to the south-west of the Medina, had several important consequences. First, the Muslim forces were three times less than the Meccans. Secondly, the discipline of Muslims who left their homes in Mecca may have shown for the first time the possibilities of those who were expelled from their native city. Thirdly, one of the allied tribes that promised Muslims in the Battle of Badr support, but then, when hostilities began, it did not have it, was expelled from the Medina a month after the battle. So, those who called themselves allies of Muslims, but secretly opposed them, received a serious warning: no one will tolerate betrayal.
A year later, the Meccans again opposed the Muslims. After gathering a three thousand strong army, they met at Mount Uhud, not far from Medina. Fought at first successfully, the Muslims were defeated, and the Prophet himself was wounded. Since the Muslims were not completely defeated, the ten thousandth army of the Meccans again attacked Medina two years later, but with a completely different result. In the Battle of the Ditch, also known as the 'Battle of the Allies,' the Muslims won a landmark victory by introducing a new form of defense. On the other side of the Medina, where the attack was expected, they dug a deep moat into which the Meccan horsemen fell, while the Muslim archers safely settled on the earthen ramparts on the part of the Medina. After an inconclusive siege, the Meccans were forced to retreat. After that, Medina became a city of Muslims forever.