information:filtering, structural:expansion, quality:correction
Opposition to Muhammad

The Makhzum were strongly opposed to Muhammad, and the clan's preeminent leader Amr ibn Hisham (Abu Jahl), Khalid's first cousin, organized the boycott of Muhammad's clan, the Banu Hashim of Quraysh, in c. 616–618. After Muhammad emigrated from Mecca to Medina in 622, the Makhzum under Abu Jahl commanded the war against him until they were routed at the Battle of Badr in 624. About twenty-five of Khalid's paternal cousins, including Abu Jahl, and numerous other kinsmen were slain in that engagement.

The following year Khalid commanded the right flank of the cavalry in the Meccan army which confronted Muhammad at the Battle of Uhud north of Medina. According to the historian Donald Routledge Hill, rather than launching a frontal assault against the Muslim lines on the slopes of Mount Uhud, "Khalid adopted the sound tactics" of going around the mountain and bypassing the Muslim flank. He advanced through the Wadi Qanat valley west of Uhud until being checked by Muslim archers south of the valley at Mount Ruma. The Muslims gained the early advantage in the fight, but after most of the Muslim archers abandoned their positions to join the raiding of the Meccans' camp, Khalid charged against the resulting break in the Muslims' rear defensive lines. In the ensuing rout, several dozen Muslims were killed. The narratives of the battle describe Khalid riding through the field, slaying the Muslims with his lance. Shaban credits Khalid's "military genius" for the Quraysh's victory at Uhud, the only engagement in which the tribe defeated Muhammad.

In 628 Muhammad and his followers headed for Mecca to perform the umra (lesser pilgrimage to Mecca) and the Quraysh dispatched 200 cavalry to intercept him upon hearing of his departure. Khalid was at the head of the cavalry and Muhammad avoided confronting him by taking an unconventional and difficult alternate route, ultimately reaching Hudaybiyya at the edge of Mecca. Upon realizing Muhammad's change of course, Khalid withdrew to Mecca. A truce between the Muslims and the Quraysh was reached in the Treaty of Hudaybiyya in March.