If it is found that the defendant is guilty, the judge decides the punishment.
The defendant now becomes a convicted criminal.
The judge has to think about the facts of the crime and the kind of person the criminal is when deciding their 'sentence'.
Only the more serious crimes may end in the criminal going to prison, many criminals have to pay fines or do good work for their community instead.