Authorities said the riot, which raged from Sunday afternoon into Monday morning, grew out of a fight between two of the country's biggest crime gangs over control of prisons and drug routes in northern Brazil.