When Mehemet Ali went to Arabia to prosecute the war against the Wahhabis in 1813, Ibrahim was left in command in Upper Egypt.
The campaign lasted two years, and terminated in the destruction of the Wahhabis as a political power.
The holy cities had been recovered from the Wahhabis, and Ibrahim's task was to follow them into the desert of Nejd and destroy their fortresses.
In 1811 the massacre of the Mamelukes left Mehemet Ali without a rival in Egypt, while the foundations of his empire beyond were laid by the war against the Wahhabis and the conquest of the holy cities of Mecca and Medina.
He next took Jidda and Mecca, defeating the Wahhabis beyond the latter place and capturing their general.