Yu Woo-sung, a defector from North Korea, in 2014 in Seoul, South Korea. Mr. Yu, who was cleared after his arrest in 2013 on spying charges, is featured in the film “Spy Nation.”CreditJean Chung for The New York Times

SEOUL, South Korea — They were beaten and forced to make false confessions. Many spent years in prison. Some were executed. Most were forgotten for decades.

Over six decades, scores of people were arrested by the South Korean authorities and accused of spying for North Korea, only to be exonerated, sometimes decades later, long after many of them had served lengthy prison sentences. There has never been an official tally of the exact number of people affected, but a new film has documented almost 100 cases, some of which involved alleged spy rings with multiple people.

The cases have mainly disappeared from public memory, but the new documentary, by the investigative journalist Choi Seung-ho, is lifting a veil on what he sees as one of the most shameful legacies of South Korea’s counterintelligence authorities.

Just before the closing credits of the film, “Spy Nation,” a list of the names of the falsely accused scrolls down the screen. It is an eloquent indictment of the abuse of power engaged in by South Korea’s counterespionage agencies, especially the National Intelligence Service, in the name of fighting the Communist threat from North Korea.

In the 100-minute film, Mr. Choi stresses that “manufacturing spies” cannot be dismissed as a distant memory in South Korea, where critics say the veneration of security above all else allows the spy agency to continue to operate with a vast, abusive power.

“With this film, I wanted to ask the N.I.S., ‘What have you done?’” Mr. Choi said after a recent screening of the documentary, which is scheduled to reach local theaters next month. “It did what it did because it could get away with it.”

Mr. Choi, a former TV producer now affiliated with the independent investigative news website Newstapa, accosted or ambushed interrogators and former top officials from the N.I.S., as well as state prosecutors who worked with them in espionage cases. He challenged them with questions in front of courthouses, at elevators and in airport lounges. All refused to answer, some running away.

South Korea created the N.I.S., initially known as the Korean Central Intelligence Agency, in the 1960s to catch spies from North Korea, with which it remains technically at war. But under successive military dictators, including Park Chung-hee, the father of the current president, Park Geun-hye, the intelligence service and other state agencies were also accused of concocting fake spy cases to arrest and discredit dissidents and divert attention from domestic crises.

But even as many of the victims were cleared of spying charges, some posthumously, the intelligence service was accused of fabricating new cases.

“Spy Nation” chronicles one such case, the story of Yu Woo-sung, an ethnic Chinese from North Korea who defected to the South in 2004.

Mr. Yu, 35, was considered a rare success story among defectors from the North, who often have trouble adapting to life in the South. He was working as a welfare official at Seoul’s City Hall in 2013 when the N.I.S. arrested him on charges of spying for North Korea. The agency based its accusation largely on confessions it said Mr. Yu’s sister, Ga-ryeo, had made after entering South Korea from the North in 2012.

At the time, the agency was being plunged into a major scandal. A team of secret agents was accused of running an online smear campaign against Ms. Park’s rivals before her election in December 2012. The agency’s former director, Won Sei-hoon, was later convicted on charges of meddling in domestic politics.

Mr. Yu’s arrest made headlines, a coup for the intelligence service, which was desperate to salvage its image.

“One day I was a model defector, and the next they made me an evil spy,” Mr. Yu said in an interview in 2014.

But Mr. Yu’s sister later testified in court that officials had beaten and coerced her into making false confessions against her brother while they held her without legal representation in solitary confinement at the agency’s interrogation center for 179 days. The agency denied using coercion at the center, south of Seoul, where it screens fresh arrivals from the North for up to six months to ferret out spies.

Photos that the agency presented as evidence in court, saying they had been taken while Mr. Yu was secretly visiting North Korea in 2012, turned out to have been taken in China. The Chinese immigration documents that the agency said had recorded Mr. Yu’s border crossings into North Korea were found to have been faked. A Korean-Chinese man stabbed himself in a Seoul hotel room after leaving a suicide note saying the agency had promised to pay him to fabricate the documents. The officer who hired him also tried to kill himself by inhaling carbon monoxide in his car. (Neither man died.)

The court threw out the espionage charge against Mr. Yu.

While all this was unfolding in 2014, the agency announced the arrest of another suspected spy, also a defector from the North. But the man, Hong Kang-cheol, walked free after a court declared his confessions invalid because he had not been informed of his right to remain silent and consult a lawyer.

Mr. Hong said he had been held in solitary confinement for 84 days and forced to write draft after draft of a confession until a fictional version emerged that satisfied his interrogators.

“I had no freedom to meet visitors, no freedom to move, completely isolated from the outside,” Mr. Hong said after an appeals court upheld his acquittal in February.

Over the years, the intelligence agency has repeatedly pledged not to abuse its power or act as a political tool of presidents. But scandals at the secretive agency have frequently rocked the country, with several of its directors ending up in jail.

Ms. Park apologized for the agency’s fabrication of evidence against Mr. Yu and replaced the N.I.S. chief in 2014. The agency has also promised to make its operations at the interrogation center more transparent.

But scrutinizing the N.I.S. remains highly delicate in South Korea, where right-wing activists consider any criticism of the agency a “pro-North Korean” attempt to undermine national security. No multiplex chain has come forward to screen the film. Mr. Choi was able to schedule its theatrical release for October only after 35,000 people paid for tickets in advance through an online campaign. He also plans to take his film to Japan and to the Sundance Film Festival.

Mr. Choi said he hoped his movie would spark reform of the agency, adding that its abusive practices were not properly scrutinized by the country’s Parliament or mainstream news media.

Driving his message home are the voices of the unjustly accused.

Lee Cheol, 68, one of the former political prisoners interviewed in “Spy Nation,” was sentenced to death in 1977 on spying charges. He was freed after 13 years, but was exonerated only last year in a retrial.

His memory of torture remains raw.

“They made me naked and beat me randomly, threatening to burn my genitals with cigarettes,” Mr. Lee said. “They threatened to rape my fiancée and even her mother. In the end, I told them I would confess to whatever they wanted me to.”