An all-girls Roman Catholic high school, St. Michael's admitted many students who had been rejected by every other parochial school in the city because of poor grades or troubled behavior — then graduated three-quarters of them with state-certified Regents diplomas.

For years, it cobbled together contributions from Wall Street donors, alumni and some of its own teachers and administrators to maintain a fragile educational hothouse that placed 95 percent of its graduates in college.

And with a total enrollment of only about 200 students, it has fielded one of the best girls' basketball teams in the country. The team was state champion in 2009.

Then, on a Friday afternoon in March, students and teachers learned that St. Michael's, established by Irish nuns in 1874 to educate the children of the New York waterfront's longshoremen, would close at the end of the school year.

The announcement came just a few hours before the talent show. Girls in the cast ran to the office of an assistant principal, Michael Duff, crying "like it was the end of the world," he recalled. "I said: 'Look, we could postpone it until Monday. Nobody would hold it against you.' But they said: 'No, we've got to have it today. Today!' "

This month, the Archdiocese of New York will oversee the merger of two schools and the shuttering of two others, including St. Michael's. Dozens have closed in recent years as part of an effort to salvage a school system ravaged by rising costs, falling enrollment and what church officials refer to as the "changing demographics" of their students.

St. Michael Academy defines what they mean by that phrase. A half century ago the school, on West 33rd Street between Ninth and 10th Avenues, had 900 students, most from Irish- and Italian-American two-parent households that could afford to pay full tuition.

This year, compounding the problem of its much smaller enrollment, about 80 percent of the students come from families living below the poverty line. The $600-a-month tuition is an impossible amount without scholarships and other considerations, like the odd jobs, including scrubbing floors, that some parents do at the school to work off their bills. So many asked for the jobs, the school kept a waiting list.

That devotion to a St. Michael's education hardened into a kind of bitterness this spring, as many parents and alumni complained that they were blindsided by the decision to close.

"I went to parents' meetings, and never once did anyone tell us that we should try to raise money, try to recruit more kids to come to the school," said Carmen Ruiz, the mother of an 11th grader. "We could have painted the place. Everybody would have helped. But 'We're closing?' Like magic, that's it?"

Alumni raised pledges of about $50,000 in the three days after the announcement, but said no school or church official would meet with them to discuss alternatives to the closing.

Michael Radice, whom the school hired last year to raise money and enrollment, said the decision to close was made by the Rev. Myles P. Murphy, the pastor of St. Michael Parish, and was unforeseen by the entire staff, including Mr. Radice. Father Murphy declined requests for interviews.

Mr. Radice, who has been acting as Father Murphy's spokesman, said informing parents and alumni earlier about the school's straits might have generated some money, but might also have scared away potential enrollees. Unaware of the imminent closing, school officials had increased freshmen enrollment for next year by 20 percent. "Apparently not enough, as it turned out," he said.

Starting in September, the school building will be leased to the city's Board of Education, which plans to use it to house a middle school, the Clinton School for Writers and Artists.

The parish has operated the academy since its beginning, when the Sisters of Presentation of the Blessed Virgin Mary, based in Ireland, were invited to set up an elementary school behind the church on Ninth Avenue. It became a co-ed high school in the early 20th century, and an all-girls school after World War II.

Sister Kathleen Cusack, who was the principal from 1989 to 2007, said the end of St. Michael's was the end not only of one school, but also of an era in West Side history. It was the tempestuous, Catholic newcomers' side of the city evoked in fictions like "On the Waterfront" and "West Side Story" but confronted in reality every day at St. Michael's by nuns like Sister Dolores, her dean of students.

Sister Dolores would drive to the house of a truant and park across the street. "She'd call up on the phone and say: 'I know what you're doing. If you're not in school tomorrow, I'm coming to get you. Don't make me do it,' " Sister Cusack said.

"These were kids, some of them, who never in their life had anybody take an interest like that," she said. Now, she added, "there is no Catholic school for girls on the West Side, not from downtown all the way up to the Bronx."

Most of St. Michael's students are being enrolled at Cathedral High School, an archdiocesan girls' school on East 56th Street.

But the 14 remaining members of the champion Eagles basketball team, after considering offers from nearly every high school basketball power in the city, public and private, have decided to stay together by enrolling en masse at Nazareth Regional High School, a co-ed Catholic school in Brooklyn that has had no girls' basketball team. Starting in September, they will be the Nazareth girls' basketball team.

Apache Pascal, their coach, said: "The day of the announcement they were closing, I had a dozen girls who all they knew in their life was disappointment until they became one of the top 10 teams in the country playing for St. Michael — and now the rug was pulled out from under them. It was so horrible, I can't even explain it."

The talent show that same day took place on schedule, and the emotion of the announcement lent the performances a quality that Mr. Duff, the assistant principal, called "an extra something."

The valedictorian, Saran Sidime, from Guinea, West Africa, joined a senior from Pakistan, Sahrish Irfan, in original choreography that wove together the traditional dances of their home countries.

Some teachers winced at a few of the vocals they had reluctantly allowed on the program, like Usher's "Hey Daddy." But that day the suggestiveness of the lyrics became far less noticeable than the vulnerability of the girls singing them.

By acclaim, the winner of the last St. Michael talent show was Crystal Alvarez, a freshman who by Mr. Duff's account is one of the most talented singers ever to attend the school. "I tried to get her into La Guardia," he said, referring to New York City's specialized school for the arts, "but by the time we found out it was too late."

Ms. Alvarez's version of Mary J. Blige's mournful R&B song "I'm Going Down" brought down the house.