Bad luck from a combination of heavy rains hitting during the replacement of a large Tijuana waste water pipe caused 140 million gallons of untreated raw sewage to flow north for 17 days into the United States, and then out to the Pacific Ocean.

The spill began on February 2 during the first major rehabilitation of a major Tijuana sewage collection pipe that was first laid in 1991 as part of the 1985 Border Environmental Agreements settlement of pollution litigation between the Mexican and U.S. The pact allowed virtually unlimited expansion of Tijuana’s maquiladora export processing zone.

According to the Associated Press, Imperial Beach, California’s Mayor Serge Dedina said residents of his city and other coastal communities just north of the border had complained about the heavy stench for 17 days. But it was not until the raw sewage flow stopped that the joint Border Environment Cooperation Commission acknowledged the massive leak was not due to big runoff from the “Pineapple Express” monsoon storm-train.

Dedina complained on his Twitter account, “More than 143 million gallons of raw sewage were discharged into the Tijuana River, which flowed through south San Diego, into Imperial Beach, closed beaches from the border all the way to Coronado.” He added, “This is the worst spill we’ve had in over a decade.”

The Treaty of Guadalupe Hidalgo, which ended the Spanish-American War, transferred Alta California to the United States in 1848 and set the border line according to Spanish land grants, rather than geographic markers.

As a result, about 6 miles of the Tijuana River flows north from Tijuana’s Zona Urbana Rio through California’s Tijuana Slough National Wildlife Reserve and drains directly into the Pacific Ocean near Imperial Beach.

The maquiladora trade agreement signed in 1965 between the United States and Mexico envisioned that someday there might be 500 Mexican manufacturing plants established along the nations’ 1,954-mile-long border. But there are now 570 maquiladora plants operating in Tijuana alone that directly provide more than 100,000 manufacturing jobs and provide economic stimulus for up to 1 million more jobs.

With the swelling population putting huge stress on Tijuana’s waste water treatment capability, the Mexican government spent $9 million to open the La Morita sewage treatment plant in April 2010. The move marked the first region in Mexico to treat 100 percent of its sewage.

Baja California Gov. José Guadalupe Osuna Millán told a crowd at the April 2010 inauguration ceremony, “This project puts Baja California at the vanguard of sewage treatment in Mexico.” But just two months later, a break in the City of Tijuana main sewage line caused 2.1 million gallons of raw sewage to flow north into the Tijuana River Valley on the U.S. side of the border.

Imperial Beach lifeguards are continuing to test for water pollution several times a day along the city’s main beaches. They will also enforce keeping the area closed to swimming until the water purity returns to a safe level.