A small fishing town in Massachusetts is coming to terms with the news that 17 teenage girls at the local high school are pregnant, almost half of them having entered a pact to have babies and raise the children collectively.

Officials in Gloucester have discovered that the extraordinarily high number of pregnancies among the school's 15- and 16-year-olds - four or five times the average annual number - is not a coincidence. The revelation of a pact among up to eight of the girls has prompted heated debate locally about the approach to sex education and contraception.

Teachers at the 1,200-student Gloucester high school first noticed something strange last October when several girls began visiting the school health clinic to request pregnancy tests.

By March the number of pregnant girls in the school had risen to 10 and officials were alarmed. By May, the health clinic reported that an unusual number of girls were still asking for pregnancy tests.

The head, Joseph Sullivan, told Time magazine that some of the girls seemed upset when they received negative results. Others reacted to positive test results with high fives, talking about how they would hold a celebration for the baby.

Christopher Farmer, the school superintendent, said inquiries were started when the number reached 10. "They are young white women. We understand that some of them were together talking about being pregnant and that being a positive thing for them," he told Associated Press.

The disclosure of the pact, and reports that one of the fathers is a 24-year-old homeless man, has sparked a spirited debate in Gloucester about teenage sex. In May the medical director and nurse at the school clinic resigned in protest at the refusal of the local hospital that controls their funds to allow them to distribute contraceptives to pupils without parental consent.

The hospital authorities made it clear they were anxious about the reaction to handing out contraception from the strongly Catholic local community. In the absence of provision by the clinic, students must travel 20 miles to the nearest women's health clinic .

The state of Massachusetts has also been cutting back on sex education in schools as part of its budgetary belt-tightening. A local provider of reproductive health education has slashed its outreach staff from eight to one full-time worker.

Experts in teenage sexual behaviour were baffled by the events in Gloucester, which are unprecedented. "The pact is quite shocking. This is the first time I've heard of anything like it," said David Landry of the Guttmacher Institute, which promotes reproductive health.

Gloucester's conundrum falls at an already anxious time for teenage pregnancies in America. Nationally, records showed a steady decline in teenage birth rates from 1991 to 2005, with most of the fall due to greater use of contraception.

But in 2006 birth rates for girls aged 15 to 17 rose by 3%. It is too early to know whether this is the start of a trend.

Landry said that underlying statistics showed that improvements in reproductive health - particularly the use of condoms - achieved through the 1990s had stagnated since around 2003. Though it is impossible to say why the tailing off has happened, he pointed to the Bush administration's $1bn programme to promote abstinence rather than contraception.

"The problem with the policy is that it says nothing to those teenagers who do have sex," he said.

In Gloucester, a town of 30,000, speculation around the girls' motives has focused on the media. Commentators have pointed to films portraying pregnancy in a humorous and empathetic light such as Juno and Knocked Up.

• This article was amended on 16 November 2011. The original said "teenage pregnancy" is portrayed in films such as Knocked Up. This has been corrected.