Mustafayev was drafted into the Red Army in August 1941. He fought in combat from March 1942, fighting in the Battle of the Caucasus. Mustafayev became a rifleman in the 5th Rifle Company of the 55th Guards Rifle Division's 164th Guards Rifle Regiment. In fall 1943, he participated in the Kerch-Eltigen Operation. He crossed the strait with the first group of the regiment. On 3 November, during the battle for Height 102 northeast of Kerch, heavy fire stopped the advance. Mustafayev crawled to a bunker on a height and threw grenades, reportedly killing five German soldiers. His unit then reportedly captured the height. In a battle in a trench, Mustafayev reportedly killed four more German soldiers, captured a machine gun and opened fire on German troops. Mustafayev reportedly hoisted a red flag on Height 102. He was wounded, but reportedly did not leave the battlefield. During the fighting on the Kerch Peninsula, Mustafayev reportedly killed 40 German soldiers. He was evacuated the next day. On 16 May 1944, he was awarded the title Hero of the Soviet Union and the Order of Lenin.