Born to Albanian parents[REF][REF] in Merzifon, Mustafa was educated in the household of Mehmed Köprülü and married into the powerful Köprülü family [REF].
He served as a commander of ground troops in a war against Poland, negotiating a settlement with Jan Sobieski in 1676 that added the province of Podolia to the empire.