A candidate from Mandera who is accused of treason will remain in police custody until Monday.
The student from Elimu Bora Secondary School in Mandera East is facing the charge at a local law court.
It is alleged that he wrote in the KCSE English paper one (functional skills) that he would kill President Uhuru Kenyatta.
While arranging the English paper for marking, the Kenya National Examinations Council officials in Nairobi discovered the suspect had written he wanted to kill Uhuru.
They checked the candidate's registration number and found he was Elimu Bora Secondary School, which is about 2km from Mandera town.
While giving his ruling on Friday afternoon, resident magistrate Duncan Mtai said the suspect should be taken to the county hospital for a mental and age assessment.
The case will be mentioned on Monday when Mtai is expected to either deny or give detectives seven days to conclude investigations.
In the penal code, treason is where people or an individual image, invents, devises or intends the death, maiming or wounding, or the imprisonment or restraint of the President.
However, the Constitution says that no person charged with treason, or with any of such felonies, can be convicted, except on their own plea of guilt or if there is evidence offered in open court by at least two witnesses to an overt act of treason or felony alleged.
Treason, concealment of treason and subversion charges were used to detain and imprison critics of former President Daniel arap Moi's regime.
The adoption of the 2010 Constitution did not lead to a repeal or amendment of these laws.
During the 1982 coup, 12 plotters - including armaments technician Corporal Bramwel Njereman, Corporal Walter Ojode, Hezekiah Ochuka and Pancras Otenyo - were convicted of treason and sentenced to death.
They were executed on the night of July 10, 1985, at Kamiti Maximum Security Prison. More than 900 people were jailed at the end of the putsch.