A soldier from Kinross has become the first person in Scotland to be convicted of transgender prejudice.
Perth Sheriff Court heard how Terry Porter targeted Chloe Dow with verbal abuse and also threatened violence.
Porter admitted breaching the peace by behaving in a threatening or abusive manner likely to cause fear and alarm.
The 19-year-old will be disciplined by chiefs in the 2nd Battalion of the Royal Regiment of Scotland.
Sheriff Michael Fletcher described the incident as "a nasty offence" and fined Porter £350.
This was £150 more than a breach of the peace fine, to mark the transgender prejudice.
The incident took place on 8 May in Milnathort where Ms Dow was staying with Oliver Bond, who opened the door at 03:50 after hearing a loud banging.
Fiscal depute Rebecca Kynaston, prosecuting, told the court: "The complainer is transgender. She is awaiting gender reassignment surgery.
"The accused asked if Miss Dow was a boy or a girl."
The court heard how Porter went towards the bedroom and shouted: "Get up or I'll drag you out or knock you out. You're a mutant. What a state. You look like a freak."
After Ms Dow came to the bedroom door, the accused threatened violence and said: "You're disgusting". He then elbowed Ms Dow and continued to threaten violence as he was ushered out of the property.
The fiscal depute said police arrived at the house to find Ms Dow "extremely distressed".
Porter was arrested at home and denied any assault. When asked about his view of transgender people, he replied: "It's their choice."
At court, Porter admitted arriving uninvited, demanding Chloe Dow vacate the bedroom, elbowing her, threatening violence and shouting abuse relating to her transgender status.
He also admitted that the offence was aggravated by prejudice relating to transgender identity, the new law having been introduced in March 2010.
Solicitor Peter O'Neill, defending, described his client as "immature".
"He had been drinking heavily," said Mr O'Neill.
"He behaved in a manner he describes as completely out of order. He has nothing against transgender people and feels like a complete idiot for insulting this woman and he is very sorry for his actions."
Stonewall Scotland director Carl Watt said: "Too many people in Scotland experience hate crimes, and many don't report it because they think it won't make a difference or because it happens on such a regular basis."