SAN FRANCISCO (KGO) -- A federal judge accused a San Francisco police officer of perjury after video evidence directly contradicted his testimony, and then dismissed the case.Federal prosecutors had no idea that lawyers for Brandon Simpson, the suspect arrested with a loaded gun, had a security video; video that would result in the case being dismissed.Officer Nicholas Buckley had signed a sworn declaration detailing the arrest last December in the Tenderloin. He was testifying Thursday in federal court before Judge Charles Bryer.He repeated what he said in his declaration that he and his partner had just broken up a dice game on Eddy and Taylor streets and that he engaged Simpson who looked suspiciously at him, "ignored his commands acted aggressively," and tried to "sprint away up the hill."Buckley and other officers took him down and arrested him. That's when they found a gun.Public Defender Jeff Adachi has a different account."They went into court and just told boldfaced lies to the judge and to the U.S. attorney," he said.After Buckley testified, Simpson's lawyer showed the court a security video from an apartment building near the intersection.It shows the officer and his partner arriving first and breaking up the dice game.Video shows them interacting with Simpson and there's no evidence he acted aggressively, nor did he try to escape by sprinting up a hill.Then you see them grab him quickly and take him down before other cops arrived to help as they struggled with Simpson on the ground."They went up to this man and basically grabbed him for no reason," said Adachi.After viewing the video, prosecutors asked Bryer to drop the charges.The judge said the officer "perjured" himself and that it was "an affront to all of us" and that he was "deeply saddened."In an unusual nive, Bryer ordered prosecutors to give copies of the video to Chief Greg Suhr.Simpson was released late Thursday, all because of the video.The question now is will the officer and his partner, who also wrote a sworn declaration with the same scenario, be charged with perjury under oath. The San Francisco Police Department told ABC7 News that they've launched an investigation.