Disgraced ex-Assemblyman Nelson Castro was hauled into Bronx court today in handcuffs to be arraigned on the four-year-old perjury indictment that led him to flip and start working as an undercover informant against his fellow Albany legislators.

The indictment was unsealed for the first time, and revealed details about how Castro had allegedly perjured himself during a 2008 city Board of Elections hearing, where he denied under oath knowing two people who were helping him with his campaign that year.

Nelson Castro Indictment by New York Post

The Democrat resigned his seat on Monday, days after his role as an informant was disclosed on the heels of the federal bribery arrest of fellow Bronx Assemblyman Eric Stevenson. Castro last week revealed that in addition to Stevenson, he had also cooperated with authorities in other investigations of corrupt politicians over two terms in office — a revelation that his rocked the Albany statehouse.

Castro’s perjury case will eventually be dismissed if he continues cooperating with authorities in their investigations. He also would not be prosecuted for several other crimes, including an alleged scheme to forge or fraudulently obtain signatures for a petition to get on the Assembly election ballot, and another scheme to fraudulently register 30 people in his Bronx district who did not actually live there.

He was released on his own recognizance today after a brief arraignment in Bronx Supreme Court, and was ordered to return there for a Sept. 18 hearing in the case.

Castro became an informant for the Bronx district attorney’s office after he was indicted in 2009 by a Bronx grand jury. That case was not publicly known until Stevenson was arrested last week, and Castro’s role as a cooperating witness in the Stevenson case was disclosed.

In 2008, the Board of Elections began examining Castro’s eligibility to run as a resident of the 86th Assembly District in The Bronx. That probe was sparked by allegations that numerous voters were registered at the same addresses as Castro’s home, and the home of a campaign worker named Steve Santana.

During an Aug. 7, 2008 board hearing, Castro “lied under oath in his response to three separate questions,” the DA’s office said yesterday.

In the first two questions, Castro answered, “No,” both times when asked if he knew people named “Steve Santana” and “Desdemona Cruz,” according to the perjury indictment.

Castro also was asked if he was aware that Cruz had served on the so-called “Committee to Fill Vacancies,” which selected candidates.

“As I said before, perhaps she was in it,” Castro answered, according to the indictment. “I did not know.”

In fact, prosecutors said, Castro knew both Santana and Cruz, who were “assisting him in his campaign” that year, and he also “had personal knowledge” that Cruz was on the committee.

If he fails to live up to his non-prosecution agreement with federal and state authorities, Castro faces a possible maximum sentence of 2 1/3 to 7 years in prison if convicted of the perjury charges.

But if he does fully cooperate, authorities will not prosecute him on the perjury case, as well as other possible crimes connected to his 2008 campaign.

Specifically, Castro would not be prosecuted for his participation in “a scheme” in June 2008 “to forge or otherwise fraudlently obtain signatures on petitions” to become an Assembly candidate, according to his non-prosecution agreement with the Manhattan US Attorney.

He also would not be prosecuted for “a scheme” that same months “to fraudulently register approximately 30 individuals to vote within the 86th District when, in fact, those individuals resided outside of the 86th District,” the agreement said.

Additional reporting by David Seifman