Mustafa Bayram was from Yemen and Selman Reis' nephew. After Selman Reis fell into a dispute with Hayreddin al-Rumi in 1528, he was murdered later on by al-Rumi. The two had fights because Selman Reis was relieved of the duty to lead the Ottoman Navy in the Red Sea and Indian Ocean. However he refused to step down and continued to lead the navy. Nonetheless, the post had been given to al-Rumi. Before Selman Reis was killed, he had given an order to Mustafa Bayram and Hoca Sefer. Under Mustafa Bayram's supervision, they would go to Diu and help Bahadur Shah of Gujarat to fight against the Portuguese Empire.
After Mustafa Bayram had received the order from Selman Reis, he did all necessary preparations and led his fleet to Diu with Hoca Sefer. Selman Reis could not trust anyone else but except for Mustafa Bayram, his nephew and Hoca Sefer, his disciple because the Battle of Diu (1509) had not been successful and in this way they had to come back with a great victory. It was not only Diu and Bahadur Shah of Gujarat were in danger. Manuel I of Portugal threatened the whole Muslim world with destroying Mecca and Jeddah.
In the Siege of Diu (1531), Nuno da Cunha was leading the Portuguese Empire's navy and Mustafa Bayram was leading the Ottoman Empire's navy and the defenders of the Gujarat Sultanate. Mustafa Bayram had defended Diu and Bahadur Shah of Gujarat to be able to fulfill his uncle's, Selman Reis', last order with Hoca Sefer. The Portuguese Empire was in this way defeated by Muslim firepower.