Main article: List of expeditions of Prophet Muhammad
The Ansar helped Prophet Muhammad in several battles. One of the earliest battles they helped him in was the Invasion of Buwat. A month after the raid at al-Abwa that was ordered by Prophet Muhammad, he personally led two hundred men including Muhajirs and Ansars to Bawat, a place on the caravan route of the Quraysh merchants. A herd of fifteen hundred camels was proceeding, accompanied by one hundred riders under the leadership of Umayyah ibn Khalaf, a Quraysh. The purpose of the raid was to plunder this rich Quraysh caravan. No battle took place and the raid resulted in no booty. This was due the caravan taking an untrodden unknown route. Prophet Muhammad then went up to Dhat al-Saq, in the desert of al-Khabar. He prayed there and a mosque was built at the spot. This was the first raid where a few Ansars took part.
After the death of Prophet Muhammad
During the tenure of Caliphates after Prophet Muhammad, the Ansar mainly became important military elements in many conquests, (as indicated with the appointing of Thabit, bin Qays bin Shammas, an orator of Ansar), to lead Ansaris in support of Khalid ibn al-Walid in the Battle of Buzakha at the time of Caliph Abu Bakr. Later they also played a prominent role in the Battle of Yamama where Ansars under Al Bara bin Malik Al Ansari charged at a perilous moment of the battle marking its turning point. The battle of Yamama is also where the Ansar's most prominent warrior, Abu Dujana, fell.
In the year 24/645, during the caliphate of Uthman Ibn Affan, prominent Ansaris also held major positions like Al-Bara' ibn `Azib who was made governor of al-Ray (in Persia). He eventually retired to Kūfā and there he died in the year 71/690.
During the Umayyad era the Ansar became somewhat of an opposing political faction of the regime. They are described as closely affiliated with the Hashim Clan Contingent rather than with the incumbent Umayyad. Such Ansar-Hashim connections are described as forming a new elite local political hegemony in Hejaz.