BEIJING — A crude oil leak from a pipeline owned by a unit of the China National Petroleum Corporation is to blame for water contamination that has affected more than 2.4 million people in Lanzhou, China, state media reported Saturday.

The official Xinhua news agency cited Yan Zijiang, Lanzhou’s environmental protection chief, as saying that a pipeline owned by the Lanzhou Petrochemical Company, a unit of C.N.P.C., caused the contamination.

The leak poisoned the water source for a water plant, introducing hazardous levels of benzene into the city’s water, Mr. Yan said. He said Saturday that the leak had been located and that repairs were underway.

Levels of benzene, a cancer-inducing chemical, in Lanzhou’s tap water rose 20 times above national safety levels on Friday, Lanzhou authorities said. The high benzene levels forced the city to turn off the water supply in one district, and city officials warned citizens not to drink tap water for the next 24 hours.