After a confrontation with Madoff in September 2006, they demanded raises and bonuses — what securities regulators called “hush money” — and agreed to remain silent about the fraud, according to the complaints.

O’Hara, 46, and Perez, 43, were taken to federal court in Manhattan for arraignment Friday. Both were released on $1 million bond. If convicted, they face up to 30 years in prison.

Gordon Mehler, a lawyer for O’Hara, declined to comment except to say his client would plead “not guilty” to the complaint. Lawrence Krantz, Perez’s lawyer, did not return messages.

The criminal and civil complaints provide an explanation for how Madoff was able to provide the steady stream of paperwork that kept investors comfortable for so long. Prosecutors said the starting point for the paper trail was an IBM computer known as “House 17.”

The 17th floor was the domain of a key Madoff lieutenant, Frank DiPascali Jr., who confessed in August to helping Madoff maintain his fraud at least since 1990.

That was the year O’Hara was hired by the Madoff firm, according to the federal filings. Perez joined in 1991.

In 1992, the Madoff scheme experienced an avalanche of paper after the SEC shut down one of Madoff’s investment conduits, the partnership of Avellino & Bienes. When it was closed, many of those investors opened individual Madoff accounts, according to the regulatory complaint.

Madoff “now had hundreds of accounts to manage, possibly over a thousand,” the SEC complaint said, and he needed a more efficient and less labor-intensive method to generate his fictitious statements, which previously had been done manually.

According to the criminal and civil complaints, Madoff coped with the flood of new accounts by using computer programs “written, maintained and updated” by the defendants.

Those programs allowed Madoff to mimic a legitimate investment-advisory business, although prosecutors contend the two programmers knew no trades were being made.

The two programmers are the fourth and fifth defendants drawn into the criminal investigation of Madoff’s fraud, whose cash losses are estimated to be at least $21 billion.

Madoff, 71, pleaded guilty in March and is serving a 150-year prison term. DiPascali will be sentenced next spring. David Friehling, who supplied Madoff’s firm with its independent audits, pleaded guilty Nov. 2 and will be sentenced early next year.