An Austrian court on Friday sentenced two couples to as many as 10 years in jail after they took their children to live in an Islamic State (IS) group-controlled part of Syria, where they were shown execution videos.

The two men and their wives, all Austrian citizens, travelled to Syria with their eight children - the youngest of whom was two years old - in December 2014, the trial in the southern city of Graz heard.

Housed by IS, the children had to watch the gruesome videos for initiation and one seven-year-old boy was even present at a beheading.

Defendant Hasan O, 49, denied in court being a member of IS and said that he worked as a masseur treating injured fighters.

"I heard in the mosque (in Graz) that you can live according to Islam there, with freedom for the women and children," he told the trial.

He just wanted to spend "10 or 12 days" there, he said.

The dream went sour, and the families fled Syria in April 2016. Turkey then extradited them to Austria and the children were taken into public care.

All four - Hasan O and his wife Kata O, Enes S. and his wife Michaela S - were convicted of belonging to a terrorist organisation, and of mistreating and neglecting children.

They were sentenced to 10 years behind bars, except Kata O, who was given nine. All except Austrian-born Muslim convert Michaela S were from Bosnia, and all had Austrian citizenship.

The judge said the sentences were intended to show "that the state of Austria won't accept something like this".

Austria has so far been spared the spate of militant attacks suffered in recent years by some other European countries.

However, about 300 people from the nation of 8.7 million have travelled to Syria since its civil war began, one of the highest numbers per capita in the European Union.