In delivering the sentence, the judge noted that the accused had violated the trust and safety that every child deserves.
The court emphasized that crimes against children are among the most serious offences under Kenyan law.
The judge added that the law must send a strong message that such acts will not be tolerated.
Family members of Tamara were present during the proceedings. Some were seen in tears as the court delivered its decision.
The loss of a young child in such circumstances has left a permanent scar on the family and the wider community.
The defence did not contest the charges after Macharia admitted to the offence.
However, the court still took time to ensure that his guilty plea was made willingly and that he understood the consequences of his decision. Once satisfied, the judge proceeded to pronounce the sentence.
The death sentence remains one of the harshest punishments available under Kenyan law, especially in cases involving murder.
Although executions have not been carried out in Kenya for many years, courts still issue the sentence as provided for by the law.
Legal experts say that when an accused person pleads guilty in serious crimes, it can shorten the trial process.
However, the court must still carefully review the case to ensure justice is served.
