JEDDAH, Saudi Arabia—Saudi Arabia early Saturday acknowledged for the first time journalist Jamal Khashoggi was killed inside its consulate in Istanbul, capping weeks of uncertainty over the fate of the Saudi government critic.

Saudi Arabia’s attorney general in a statement said Mr. Khashoggi, a prominent Saudi journalist, died following an altercation inside the consulate. The statement said 18 Saudi citizens have been detained pending the final results of a continuing investigation.

“Discussions...