The clashes trapped residents in their homes and caused fires at the country’s second largest oil refinery, city officials said.