For example, in your case, if the offence was committed within the first five years of obtaining residence, the court has the power to impose a sentence of at least two years in prison.
Then, the court can sentence less than what is permissible, but the prisoner can still be deported.
