An artist who was detained by the police after documenting mass expulsion of migrant workers from the Chinese capital was released Monday on bail, a friend said.

The artist, Hua Yong, posted dozens of short videos in recent weeks recording how the authorities had forced tens of thousands of people to leave Beijing and demolished vast swaths of neighborhoods.

The police came for him after he filmed residents protesting by blocking a roadway in the Daxing district of Beijing, and he fled the city. He was detained late Friday in Tianjin.

Ji Feng, a friend, said Mr. Hua had been held on suspicion of “gathering the masses to disturb traffic order.” He was released on a form of bail known as “qubao houshen,” which allows the police to continue investigating for up to a year. Often the suspect won’t face charges, but can be monitored and face restrictions on his ability to travel and speak publicly.