Court overtime has long been a costly burden on the department’s budget. Last year, the department spent $8.6 million, with the drug control unit charging $1.8 million. The department has defended the cost by saying officers have no choice but to respond when they are called to court by prosecutors.

“A paper record and proper documentation provide transparency, accountability, and layers of review,” Wark said. “It would be a violation to verbally summons an officer with no documentation.”

Prosecutors, who decide whom to call based on police reports and interviews with the squad, are instructed to e-mail, fax, or hand an officer a notice to appear in court, even if they have to call in an officer at the last minute, Wark said.

Police officers sent in by their supervisor do not appear in court in an official capacity, said Conley’s spokesman, Jake Wark. “If the supervisor sends additional officers to court dates when they’re not summonsed in, they’ll simply be spectators in the gallery,” Wark said. “At the end of the day, the prosecutor trying the case is in the best position to plan out his or her witness list.”

But that is contrary to the procedure officially agreed upon by police and prosecutors more than a decade ago, according to Suffolk District Attorney Daniel F. Conley’s office.

“The sergeant has the option of bringing more people in as necessary,” Commissioner Edward F. Davis said. “As long as the sergeant signs off on it, the department is satisfied that it was appropriate.”

Boston police disputed the findings, saying that in each of the cases a sergeant who supervises squads in the Police Department’s drug unit had ordered the officer to court, or the prosecutor had verbally asked the officer to appear.

The Globe discovered the pattern as part of a review of 40 cases between 2008 and 2010 that appeared to draw an excessive number of officers to court on the taxpayers’ dime. In each case, the Globe compared the list of officers who had received overtime for the case with the list of those who had been summoned by the district attorney’s office, which is primarily responsible for calling officers to hearings.

The 32 officers, from the department’s drug unit, received pay for 91 instances in which they said they were called to testify in court for trials, case conferences, or motions hearings — claims that were not backed up by copies of court notices kept by the Suffolk district attorney’s office.

Boston police officers collected more than 400 hours of overtime pay over a two-year period for court appearances that were not officially requested by the prosecutors overseeing the cases, according to a Globe analysis of a costly system that police acknowledge has been ripe for abuse.

But officers can also abuse the system, taking advantage of management flaws and clumsy record-keeping. In the last month, the department has disciplined 10 officers, including one sergeant detective, who it said collected overtime pay when they were not called to court or were in court longer than they were needed. Another sergeant detective retired with similar charges pending. The department said it is implementing changes to catch abuse more easily.

Officers are paid for four hours of automatic overtime even if they are only in court for half an hour. They are paid time and a half for each hour they work beyond four hours.

One officer, Sean Deery, who worked in the West Roxbury drug unit, was suspended for 10 days without pay because the department said he altered a court-issued notice-to-appear, by adding the names of other officers so they could receive overtime pay.

The 10 officers were disciplined following an internal audit that examined hundreds of cases in three courthouses around the city, over a period of time ranging from 12 to 18 months in 2010 and 2011. The audit found 300 to 350 instances of court overtime filings by drug unit officers that appeared to be questionable and forwarded those cases to Internal Affairs for investigation.

The audit was ordered in February 2011, following allegations that four officers in the West Roxbury drug unit showed up for a court hearing for which they had not received a notice to appear. The Globe launched its review at the same time.

The department learned of potential abuse after the prosecutor in the case alerted a police sergeant who is supposed to monitor officers coming in and out of court and sign their overtime slips.

The bulk of the problems discovered in the internal audit and subsequent Internal Affairs investigation were in West Roxbury District Court, where the 10 disciplined officers had claimed overtime. About 30 cases in Dorchester District Court are still being reviewed. In Brighton District Court, Internal Affairs is still investigating 25 instances when officers did not go to court when they had been scheduled to appear, and instead took a paid detail, another overtime opportunity.

Despite the findings, Davis said the audit and subsequent Internal Affairs investigation “revealed no major problems.”

“We were looking for systemic issues that we felt could be driving the expenditure of court time,” he said. “We didn’t find that.”

Still, police acknowledge they have had to change the system. They are exploring the possibility of computer cards to track when officers go in and out of court. The audit recommended a centralized electronic subpoena system that would monitor court appearances in real time.