“The accused left the teaching job after two days, claiming he was not comfortable teaching primary school pupils and that he was not happy with the working environment,” said Mr Mulama.
Mr Mulama told the court that on October 14, the accused visited several schools, both private and public, including Alliance Secondary, Towfiq School and Khadija Girls, and was was promised a job beginning next year.
The counsel said the accused crossed into Somalia on October 15 and spent a night in the bushes within Somalia before returning.
“He came back into Kenya on October 16 and spent three nights at the Nairobi Hotel before again crossing into Somalia on October 19 through Kamor Primary School, with his main reason being to join Al-Shabaab,” said Mr Mulama.
The prosecution said the accused confessed that he was frustrated after he failed to secure admission to a university with his A-minus score in the 2012 Kenya Certificate of Secondary Education exam.
On October 26, while in Somalia, the accused met persons believed to be Somalia administrators, who took him to Bula-Hawa to be handed over to Kenyan authorities.
The prosecution argued that the offences committed were of a serious nature owing to the security threat in the country.
“The threat is so real to an extent that the Cabinet secretary for Interior on October 9, through Kenya Gazette Supplement No.172/2015 gazetted Somalia as a terrorist designated country,” said Mr Mulama.
In mitigation, the accused told the court that although he wanted to go to Somalia his conscience told him it was not a good idea and he decided to return to Kenya.
“I wish to ask the government through the court to forgive me as I wish to continue with my studies so that I serve my country.
“I promise the court that given a chance to mix with good citizens I will reform and be a responsible citizen,” said Baraza in mitigation, before the court sentenced him and he was escorted to the Mandera GK Prison.
Baraza's arrest and sentencing come amid enhanced security in Mandera as police announced the discovery of a new Al-Shabaab cell in northeastern Kenya that is planning mass evictions in the region.
Police believe the cells operate from Wajir and spread terror to other towns. It is also recruiting youths from the region under the leadership of Mohamed Kunow Yussuf.