A 16-year-old boy has been given a four month community-based order after tormenting a black swan with a vape and later dumping the dead bird in bushland.

The incident happened in July on a boat near Dawesville, south of Perth, and video of it was later posted online. The court heard the teen shoved an electronic cigarette into its beak before smoke was blown down the bird’s throat. A 13-year-old boy then slapped it on the head.

After the swan died, the cruelty continued off the water. The older boy dumped the bird in bushland near a conservation park, where it stayed hidden for two weeks before police located it.

Both teens were charged with animal cruelty. They claimed they had seen a swan with a fishing lure stuck in its neck and had wanted to help.

When the matter came before court, the older boy’s lawyer argued it should be dealt with behind closed doors, pointing to public anger directed at the teenager and his family. That application failed.

A Rockingham magistrate described what happened as a “graphic and awful error of judgement”.

The older boy told the court he had been “showing off to his younger friend”. On Thursday, he was sentenced to a four month community-based order.

“There is absolutely no reason for it and it is very serious, and we are alarmed when we see matters like this coming through,” RSPCA WA chief operating officer Hannah Dreaver said.

The younger boy will be sentenced later in September.