The Battle of Badr is the battle referred to in the first statement. This battle occurred in 624 CE. It was one of the significant battles in early Islamic history. The Meccans, led by the Quraysh chieftain Abu Sufyan, brought a larger and better-equipped force to face the Muslims. Although they had initial advantages, they were unable to achieve a decisive victory against the Prophet Muhammad's followers.
The second statement pertains to the Battle of the Trench, which took place in 627 CE. This battle is notable for the innovative defensive tactic employed by the Muslims in Medina. Under the advice of Salman the Persian, a trench was dug around the city, making it difficult for the Meccan troops to launch a successful attack. This strategy resulted in the safeguarding of Medina and is considered a key moment in Islamic history, demonstrating the resourcefulness and strategic planning of the Muslim community at the time.