CAIRO  A suicide bomber who was trying to kill the head of Saudi Arabia’s antiterrorism efforts stumbled just short of his target and fell, detonating an explosion that had been arranged by an affiliate of Al Qaeda, a spokesman for the Saudi Interior Ministry said Friday.

The Saudi official, Prince Mohammed bin Nayef, who serves as deputy interior minister and is a member of the royal family, was slightly wounded in the attack in the Red Sea port of Jidda, Saudi Arabia, on Thursday, said Gen. Mansour al-Turki, the spokesman for the Interior Ministry.

The prince had allowed the wanted militant, who had come saying he wanted to turn himself in, to bypass security as a sign of good faith, General Turki said. The militant was killed by the explosion, the authorities said.

“He expressed his desire to turn himself in directly to the prince and the prince granted him his complete trust by requesting that he not be searched,” General Turki said. “And this is something that the prince does. It is not the first time, but it did not end in this deceptive manner before.”