An Iraqi refugee who was convicted of raping a 10-year-old boy in a swimming pool in Vienna has been handed an even greater jail sentence after his legal team won the right to a retrial.

Austria’s Supreme Court overturned an initial six-year prison sentence in October, ruling that the lower court had failed to establish whether or not the refugee, identified only as Amir A, knew his victim did not consent.

The court did not dispute the “watertight” evidence that some form of sexual abuse had taken place during the incident in a toilet cubicle at the Theresienbad pool in December 2015. But in Austrian law, prosecutors must prove that an attacker is fully aware the act is nonconsensual for a more severe rape conviction to hold.

Hearing the case again on Tuesday, the Vienna court found that the conditions defining rape had indeed been fulfilled, the Kronen Zeitung reported.

And upon resentencing Amir, the court decided to hand down a longer prison sentence of seven years. A figure of €4,700 to be paid in damages to the victim’s family was also increased, to €5,000.

Now 21 years old, Amir was a taxi driver in Iraq before travelling through Europe to arrive in Austria in September 2015. As a relatively newly-arrived refugee, the trip to the swimming pool was organised as part of public integration efforts.

The court heard how Amir dragged his victim into the cubicle, locked the door and raped him. The child reported the attack to a lifeguard, and when police arrived they found Amir had returned to the pool and was playing on a diving board, making no attempt to flee.

According to reports, Amir confessed to the attack in initial police questioning, telling them it had been a “sexual emergency” because he had not had sex for four months.

In its initial sentencing, the court heard how the 10-year-old victim had suffered both physical and mental injuries in the attack which amounted to serious bodily harm. The boy continues to suffer from post-traumatic stress disorder, his mother told the court.

But in mitigation, judges cited Amir’s own young age at just 20 when the crime was committed, his previous lack of convictions and his confession of responsibility.

After the new sentence was handed down, defence lawyer Roland Kier asked for three days for his client to consider launching a fresh appeal, according to Kronen Zeitung.

Amir was initially convicted of the attack in June 2016, and outrage over the case came amid a rise in anti-immigrant sentiment in Austria.

In January, one month after the attack was reported, the government introduced a controversial cap on refugees to be allowed into the country.

It set the bar at 37,500, fewer than half the number who arrived in 2015. But with the number of new arrivals dropping dramatically in 2016, the Interior Ministry said on Tuesday it “will not” see the cap breached.

It avoids a potential confrontation with the wider EU. Brussels had warned that a limit on numbers of asylum seekers would break the bloc’s rules, as well as pandering to the rise of the far-right.

Tougher restrictions brought in after a breach in the cap would have seen unsuccessful applicants turned away at the border, breaching EU rules on asylum and free movement.