The protests in Taipei turned violent after a small group of students who split off from the larger demonstration led hundreds of youngsters in storming the cabinet building.
The occupation happened after a split emerged between hawks and doves within the Black Island Nation Youth Front. They couldn't agree on whether a more violent approach would succeed in torpedoing the pact.
Wei Yang, a key member of the Youth Front, pushed for the failed occupation. About 20 members of his group believed the move would prompt the sacking of the cabinet - the Executive Yuan - according to a female student who is a front member.
The Taipei District Prosecutors Office detained Wei for his role in the break-in, although he has not been charged.
The trade accord would open many of Taiwan's service industries - including banking - to mainland investors and offer Taiwanese businesses similar opportunities on the mainland.
Some 200 students have occupied the legislature since Tuesday, saying the agreement would harm Taiwan's economy and sharply cut youth employment.
The latest occupation came despite pleas by other Youth Front leaders to ask legislators peacefully to halt their review of the trade pact. The protests have prevented the unicameral parliament from ratifying the document.
President Ma Ying-jeou rejected demands to halt the agreement, which was signed last year.
Without alerting the front on Sunday, the 20 hardline members prepared cardboard cartons, thick quilts and portable ladders to break through three layers of barbed wire barricades blocking the cabinet building, the female student said.
Wei, 24, later joined the group and tried to organise the occupation. But soon some demonstrators were seen on local TV broadcasts looting and vandalising several government offices. That prompted Ma to deploy the police.
Wei, who's been active in several protests and is the great grandson of famous Taiwanese author Yang Kui, was contrite in a post left on his Facebook page.
"I must apologise because I know such a mobilisation is irresponsible, but I still hope those who support us can come to reinforce us," Wei said shortly after the occupation.
"We decided to do this so that it can help ease the pressure on our fellow comrades at the legislature and to demonstrate our determination to the Ma Ying-jeou government."
Lin Fei-fan, the commander of the "Occupy Legislature" protest, said that although he and other students disagreed with invading government offices, "our goal is still the same and we hope that police can stop using force to deal with students".
He said Wei assumed the leadership role in Sunday's occupation to contain the risk.
Lin said the front would continue its peaceful approach to pressuring the government to halt the review of the pact, require supervision of all cross-strait agreements and refrain from any negotiation of a new accord before the law takes effect.
Additional reporting by McClatchy Tribune, Agence France-Presse