Residents of Vradiyevka, some 330 kilometers (200 miles) south of Kiev, smashed windows, broke doors and set fire to the building late Monday, while police fought back with tear gas.
The protests continued Tuesday.
The case has caused widespread anger among Ukrainians, who say that corruption, lawlessness and the impunity of government officials and their wealthy friends have increased markedly since President Viktor Yanukovych came to power three years ago.
It has also prompted an outcry among opposition lawmakers.
Officials finally caved in to public pressure and detained the officer late Tuesday, according to the Interior Ministry spokesman Serhiy Burlakov.
A court was to decide whether to keep him under arrest or to release him on bail or a pledge not to leave his place of residence.
The victim, a 29-year-old local woman, was returning home from a bar last Wednesday when she says she was shoved into a car, driven to the woods, raped and savagely beaten by two policemen, aided by a driver.
The woman remains in the hospital in serious condition, having sustained multiple fractures to her skull and bruises all over her body.
One of the suspected police officers and the alleged driver of the vehicle were detained earlier, but officials were reluctant to apprehend the second suspected policeman, who claimed he was on duty at the local police headquarters when the crime happened.
The victim, identified as Irina Krashkova, said in a video interview with local media that the police officer was lying.
"This is not true. I know 100 percent that he was there. Why? Because he was the first to rape me; he beat me and called me all kinds of names," Krashkova said, in a low, timid voice sitting on a hospital bed.
Her head was shaven and bandaged after surgery, and her face was swollen and bruised.
The Associated Press does not generally identify victims of sexual assault, but makes an exception where the victim has publicly identified herself, as Krashkova has done.
Two senior regional police officials and a prosecutor have been fired for failing to properly respond to the crime.
President Yanukovych ordered a thorough investigation and Interior Minister Vitaly Zakharchenko was summoned to the parliament.
Zakharchenko put the blame on his subordinates, saying they initially withheld the fact that police officers were implicated in the crime.
He said authorities were now checking a surveillance video from the police station, which the alleged perpetrator claims proves his alibi.
Zakharchenko also called for a reform of the Interior Ministry and a boost in its funding to attract better candidates to serve as police.
The minister expressed his sympathy to the victim and her family, though he stopped short of an apology.
His speech angered the opposition.
"I do not believe your words that you want to reform anything, same as your party," said opposition leader Arseniy Yatsenyuk.
"Do a heroic deed, write a letter of resignation."
The crime brought back memories of last year's brutal attack on an 18-year-old in the same Mykolayiv region.
Oksana Makar was raped, strangled and set on fire by three young men, some of whom had well-connected relatives.
She died of her burns two weeks later.
Two of the three suspects were initially released and were re-arrested only after nationwide protests.
The case galvanized Ukrainians fed up with the corruption that allows people with money and connections to avoid punishment, whether for violating traffic laws or for more serious crimes.