LOS ANGELES — A legal lightning bolt yesterday struck the child pornography law that had sent a former top Disney executive to jail, prompting defense lawyers and federal prosecutors to agree that he should be released as early as Monday.

An appeals court in San Francisco ruled that the federal child porn law is vague and unconstitutional.

The remarkable turn of events means that 34-year-old Patrick Naughton — former executive vice president of Disney-owned Infoseek who had been nailed for having child porn — could have his conviction thrown out.

“What we’re hoping is that the judge will grant a motion for a judgment of acquittal on (the child porn conviction) and that means he’ll stand un-convicted,” defense lawyer Donald Marks said.

Naughton was led out of court on Thursday in handcuffs after a jury convicted him of possession of child porn, but deadlocked on two more serious charges that he allegedly tried to have sex with a 13-year-old girl.

A relieved James Naughton, the software whiz kid’s older brother, said he was happy and wants his brother out of jail — now.

“This is very good, exactly what we argued for yesterday,” said James Naughton, 40, who was by his brother’s side throughout the trial. “It (his brother’s jailing) didn’t seem right.”

Defense lawyers had argued Thursday that Naughton should remain free until he’s sentenced because the American Civil Liberties Union’s challenge to federal child porn laws — filed in March 1998 — could be ruled unconstitutional.

U.S. District Judge Edward Rafeedie said Thursday he’d only release Naughton if the law was struck down — and it was 24 hours later. Federal prosecutors agreed with defense lawyers that Naughton should be released, and Rafeedie could order the defendant free by Monday.

“We’re anxious to see that Patrick is released on Monday,” Marks said.

Federal prosecutors could not be reached for comment last night.

But in a written agreement with defense lawyers asking the judge to let Naughton out of jail, prosecutors said they grudgingly accept the appeals court ruling.

“The government maintains (the appeals court ruling) is wrongly decided, but recognizes it is binding authority at this time … defendant shall be released from custody and remain free on bond,” the defense-prosecution agreement said.