Grady High School students gathered in the classroom that has been used by Good Shepherd Services, a nonprofit group that has provided support to the school. The end of a grant program means the services and partnership will end.

A month ago, administrators at William E. Grady Career and Technical High School had no reason to think the school’s after-school and enrichment offerings were at risk.

A year after getting the surprising news that the city would try to close the school, nine months after learning that the closure plan was off, and five months after reopening with a dramatically reduced student body and budget, the school was finally back on firm footing.

Administrators expected a new round of funding for extra services to kick in this fall. Since 2008, the school has offered after-school programs with the support of a state 21st Century Community Learning Center grant secured through a partnership with Good Shepherd Services, a youth and family development agency.

But last week, the school learned that in the next round of the grant, Good Shepherd wouldn’t be working with Grady, and the funding — at least $150,000 a year according to Good Shepherd — would no longer flow. The news came too late for the school to sign on to a different organization’s grant application.

Exactly why the news came as a surprise is not clear. Assistant Principal Jodi Infantolino said Good Shepherd’s on-site employees had told her they planned to stay on, and Principal Geraldine Maione said no one at the organization had communicated otherwise. But officials at Good Shepherd said they always knew they would not be able to work with as many schools in the grant’s next round — with the maximum funding reduced, the group would be able to apply for the grant in partnership with only six schools.

The bottom line is that after Jan. 14, Grady wasn’t part of Good Shepherd’s grant application, and it was too late for Maione to partner instead with the other two groups that had asked her to sign on with them.

Now, the school will have to figure out some other way to pay for the services — which administrators said had helped propel it from a D to a B two years ago — or go without them. It is the latest in a series of losses that began when the school’ federal school improvement funds vanished because of the city’s dispute with the teachers union; continued when enrollment dropped sharply; and compounded when Hurricane Sandy flooded the building last fall.

While Grady has faced a particularly tough series of blows, the episode highlights the challenge of using partnerships to pay for essential school services, something that schools have always done but that Chancellor Dennis Walcott recently urged them to do more often.

“What this is an example of is significant cuts to after-school funding, there not being enough money to go around, and organizations having to make really bad choices,” said Amy Cohen, who oversees government contracts and program development at Good Shepherd Services. “The process is very, very complex, and the rules changed in the middle. And as a result horrible things like this can happen as just an oversight of this miserable system. There’s not enough money and a very complex application process, so organizations and schools get hurt in the mix.”

Even if Grady had been included in Good Shepherd’s grant application, there’s no guarantee that the bid would have been approved.

Grady is just one of many schools across the city that rely on grants to supplement what the school can offer and help students complete enough credits to graduate. City funds for after-school programs are often the first to land on the chopping block when budget cuts are needed, and Mayor Bloomberg last month proposed cutting $10 million in city funding from an after-school initiative he created in 2005. Last year, a last-minute budget deal averted proposed cuts of an even greater magnitude.

“Once again, the mayor’s proposed cuts to after-school and early childhood programs will continue a disappointing trend of shrinking programs for the children in our city who need them most,” President and CEO of the Children’s Aid Society Richard Buery said in a statement last month after the mayor announced the preliminary budget for 2014.

With the grant funding that is still in place through the end of the school year, Good Shepherd Services staff a classroom at Grady where students can unwind, do homework, use computers, and participate in a wide range of classes. The agency also pays for four Grady teachers to teach for-credit classes after the regular school day. Infantolino said students started earning credits more quickly after Good Shepherd moved into the building.

The agency brought arts classes into the career and technical education school for the first time and organized trips to visit colleges in Boston and New York, as well as camping trips and museum visits for students Maione said “have never left their blocks in Brooklyn.”

“The staff has been amazing — young, energetic, and they relate to the kids,” Infantolino said.

“Good Shepherd staff are like parents and older brothers and sisters,” senior Orville Feanny said. ”If you’re not in class, they’ll come around and find you…to me, Andre is like a dad. I go to him for whatever advice I need, school or personal.”

Feanny said his favorite class is martial arts, and that his heart is set on attending Northeastern University, which he said he had never heard of until Good Shepherd organized a trip there.

If it weren’t for Good Shepherd programming, Feanny said, “I’d probably just play basketball and handball every day after school when I didn’t have a sports team.”

On the school’s most recent quality report, Grady was rated well-developed, the highest rating, in school culture. “This grant was part and parcel of how we were able to do that,” Maione said.