Without warning, the Oakland Unified School District has decided to stop paying AC Transit to run buses to several city schools, something the transit agency says will jeopardize service for hundreds of students.

Officials in the cash-strapped district said Wednesday that they were ending the $2.25 million annual contract with AC Transit, effective immediately. The school district has been paying for bus service for nearly 20 years without realizing that AC Transit ran buses to schools in other cities for free, Oakland schools officials said.

They disclosed their decision in an email to parents this week.

“Our district was the only school district that paid AC Transit to run lines for our students, although our Oakland students also still continue to pay individual fares to use the buses,” district spokesman John Sasaki said in the email.

Officials also cited district finances as another reason to cut off the payments, alluding to a proposed $30 million in cuts this year and next to cover projected costs.

The district notified AC Transit officials on Jan. 9, acknowledging in a letter that the news was likely to “come as a shock.” The district has not heard back, Sasaki said.

AC Transit said in a statement to The Chronicle that the move “will likely result in a reduction of supplementary bus service” if a replacement for the funding isn’t found. The service costs the agency $4.45 million a year, spokesman Robert Lyles said.

School district officials told parents, however, that they didn’t expect any disruption in current bus routes.

“We expect them to continue the same service that was provided before and during the contract,” Sasaki said. “However, OUSD is unable to provide the transportation itself.”

AC Transit has also provided extra bus service to Alameda, West Contra Costa, Hayward, Newark and Fremont school districts over the years as well as to some private schools, typically offering more buses on existing lines to get students to and from schools.

The service that AC Transit provides to Oakland includes specially created routes that begin or end at schools, which other districts don’t have, Lyles said. The bus service provides extra buses and security on regular routes to accommodate heavy loads of students, he said.

AC Transit has long run special buses to Skyline High School and Montera Middle School, among others, which are located in the Oakland hills and not along regular transit lines. The buses run only on school days.

At Skyline High, hundreds of students streamed out of class Wednesday afternoon and hurried to the line of AC Transit buses waiting at the curb. The school is remote, located near the top of a hill above Highway 13.

Xayne Bledsoe, a sophomore, said the bus was the only way he could get to school from his home in the Dimond District.

“It would take forever to walk,” he said. “I need it to come to school and to get wherever I need to go.”

Joel Evans, 15, was among the few students who didn’t board a bus. His father typically picks him up, but that’s not an option for many of his friends and classmates, he said.

“Some people can’t get rides from their parents or don’t have anyone else to get a ride from,” he said. “They would be stuck otherwise.”

For years, the Oakland school district used state funding designated for transportation costs to pay AC Transit for the service. In 2013, that money was folded into general funding for schools, yet the district continued to pay. The payments should have stopped then, but didn’t, district officials said.

It was unclear whether the school district would seek to recoup previous payments. AC Transit, however, believes the school district owes it $675,000 in back payments for transportation already provided.

Lyles urged school officials to come back to the table to work it all out.

“Safe transit from home and school has been our commitment to Oakland students and parents for 20 years,” he said. “So we implore OUSD to schedule a meeting with our staff to ensure the continued safe travels of students.”

Jill Tucker and Michael Bodley are San Francisco Chronicle staff writers. Email: jtucker@sfchronicle.com, mbodley@sfchronicle.com Twitter: @jilltucker, @michael_bodley