The cases of refugees and migrants that did not commit crimes being detained happens when they are held as witnesses or victims of criminal activities. They are detained in order to appear as witnesses during the court trials of the perpetrators (usually smugglers).
Those subject to this type of detention are housed in special facilities (typically in the closed centre Gazi Baba in Skopje). This centre is a closed centre and people are not allowed to exit it, but it is not officially a detention centre. The court proceedings usually takes up to several days before the detained witnesses get released. While in Gazi Baba, the refugees can also seek asylum in the country, in which case they are moved to the Vizbegovo center for foreigners.