NAIROBI, Kenya — Usually prisoners want to get out of jail. But on Tuesday, a group of Taiwanese citizens did all they could to stay in — barricading themselves in a small cell as Kenyan police officers tried to storm in with assault rifles.

The officers succeeded, however, in dragging the prisoners out — Taiwanese officials say after using tear gas, which Kenyan officials deny — and put them on a plane not for home, but for mainland China.

A video circulating on the Internet of the encounter shows a group of young men bracing themselves against a prison door to try to keep the Kenyan officers out. “Sir! We are Taiwan people, Taiwan people!” one of them yells.

The episode outraged Taiwanese officials, who accused Kenya of violating international law and trying to curry favor with China, which views the self-governed island as part of its territory.