The hijacker appeared to be suffering from "mental disturbances" and his motives were not known, the police said in a statement.
The police identified the hijacker as Said Faloun Said, 39, a Sudanese national, and said he was traveling on a temporary travel permit from Tripoli, the Libyan capital.
During the flight, Said entered the Airbus' cockpit and threatened the crew with a knife, demanding that the plane fly to South Africa, the police statement said.
"The crew dealt with him in a quiet, wise and responsible manner," the statement said.
When the plane landed at Khartoum airport, security officials overwhelmed Said and took him into custody, the statement said, without elaboration.