ISTANBUL (AP) — In what could be the final chapter of a graft investigation that once seemed to threaten the inner circle of President Recep Tayyip Erdogan, Turkey's parliament voted against sending four former ministers to court.

In closer votes than expected, the ruling Justice and Development Party (AKP) used its majority to sweep away an investigation that rocked Turkish politics in 2013, when prosecutors launched a spectacular series of raids. The vote was taken by secret ballots, but opposition parties made clear their position that Turkey's Supreme Court should hear the evidence. Still, the parliament voted down the measures against the four ministers each by smaller margins than expected, suggesting some members of the ruling party voted in favor.

The investigation targeted the sons of the four ministers and a prominent Iranian businessman, who were suspected of bribery and corruption. A separate investigation implicated a son of Erdogan, who was then prime minister.

The four ministers, who later resigned, have immunity as members of parliament, but the government established a parliamentary committee to investigate the allegations ahead of a vote by lawmakers on whether to refer the case to the court.

The likely evaporation of the charges against key government officials comes less than six months before a parliamentary election. So far, Erdogan's party seems to have weathered the political damage, winning local elections last year as well as Erdogan's own decisive victory in the country's first direct presidential election.

However, some analysts say using a parliamentary majority to bury the allegations has undermined the ruling party's reputation.

"This shows that however much President Erdogan may be saying he has established a new Turkey, in some areas the old Turkey is just the same as it ever was," said Gareth Jenkins, an Istanbul-based analyst with the Institute for Security and Development Policy.

Jenkins says he thinks there is strong evidence for most of the allegations even though the case hasn't gone to a court.

The revelations focused on illicit money transfers to Iran and bribery for construction projects. Sordid details of cash found in shoe and candy boxes, and a luxury watch on a minister's arm, dented the credibility of the ruling party, which came to power campaigning against the corruption of previous governments.

But Erdogan cast the raids as a conspiracy orchestrated by followers of an influential U.S.-based Muslim cleric intent on bringing down his government. Following the raids, the government moved swiftly to contain the investigation by transferring thousands of police officers, as well as prosecutors and judges, that it accused of following orders from the cleric, Fethullah Gulen.

New prosecutors eventually dropped the cases and millions of dollars seized in the raid were paid back with interest.

Former Economy Minister Zafer Caglayan, former Interior Minister Muammer Guler, former EU Minister Egemen Bagis and former Environment Minister Erdogan Bayraktar have all denied the allegations. The parliamentary committee, which included opposition members but was weighted toward the ruling party, cleared the ministers in its report citing insufficient evidence and voted 9-5 against prosecuting the ministers ahead of Tuesday's vote.

The head of the committee indicated it believes some of the material presented as evidence in the case was illegally seized.

The opposition criticized the conclusion, complaining that the ruling party denied access to important evidence. One member of the committee from the main opposition Republican People's Party, or CHP, Riza Turmen, said the evidence included was damning.

"There's no doubt what has transpired," he said. "In these files you have all the details: what amount of money was delivered, to which minister, on what date, by whom and to which address."

But an AKP member of the committee, Ayse Turkmenoglu, said even if the ministers admitted the charges, "it would not raise sufficient suspicion in me that they committed a crime."

Prime Minister Ahmet Duvotoglu said the government did not intervene in the committee's work.

"Now everyone has to show respect for the report. Our grand assembly will give its decision, according to the same legal norms," Duvotoglu said.