<P> Babur started for Lahore, Punjab, in 1524 but found that Daulat Khan Lodi had been driven out by forces sent by Ibrahim Lodi . When Babur arrived at Lahore, the Lodi army marched out and his army was routed . In response, Babur burned Lahore for two days, then marched to Dipalpur, placing Alam Khan, another rebel uncle of Lodi's, as governor . Alam Khan was quickly overthrown and fled to Kabul . In response, Babur supplied Alam Khan with troops who later joined up with Daulat Khan Lodi and together with about 30,000 troops, they besieged Ibrahim Lodi at Delhi . He defeated them and drove off Alam's army and Babur realised Lodhi would not allow him to occupy the Punjab . </P> <P> Hearing of the size of Ibrahim's army, Babur secured his right flank against the city of Panipat, while digging a trench covered with tree branches to secure his left flank . In the center, he placed 700 carts tied together with ropes . Between every two carts there were breastworks for his matchlockmen . Babur also ensured there was enough space for his cavalry to charge between these carts . </P> <P> When Ibrahim's army arrived, he found the approach to Babur's army too narrow to attack . While Ibrahim redeployed his forces to allow for the narrower front, Babur quickly took advantage of the situation to flank (tulghuma) the Lodi army . Many of Ibrahim's troops were unable to get into action, and fled when the battle turned against Ibrahim . Faced with musket fire, cannon fire and cavalry attacks from all sides, Ibrahim Lodi fought and died with 6,000 of his remaining troops . </P> <P> Babur's guns proved decisive in battle, firstly because Ibrahim lacked any field artillery, but also because the sound of the cannon frightened Ibrahim's elephants, causing them to trample his own men . </P>

Who was defeated in first battle of panipat