A South Carolina judge Thursday dismissed a North Carolina man's petition to return the Confederate flag and pictures of Stonewall Jackson and Robert E. Lee  to the York County courthouse.

Russell Walker argued before Judge Jack Kimball that South Carolina state law requires the items stay up unless the legislature votes to remove them.

In June, Walker filed a lawsuit against York County Clerk of Court David Hamilton claiming that the S.C. Heritage Act allows only the legislature to move Confederate items in public buildings.

“I expect Hamilton to follow the law. I didn’t write the law. It’s just the way it is,” Walker, of Aberdeen, N.C., told the judge.

Hamilton’s court attorney Michael Kendree argued the case should be dismissed for failing to file the complaint properly. He added injury or harm was not inflicted by the removal of the flag and portraits and thus the plaintiff lacked standing.

Walker told Fox News before the hearing that he had to do it. “I saw it going on here and if I don’t do it no one else is going to do it."

The judge questioned Walker’s motives for filing the lawsuit. “You didn’t even know they were gone, someone told you?" Kimball asked.

“Yes sir,” Walker replied.

Kimball ruled that Walker's lawsuit has no standing because he lives in North Carolina, and that it has no merit because there's been no court case regarding the Heritage Act and whether it applies to buildings.

After the judge dismissed the case, Walker told Fox News he would request all the official documents, review them and possibly get a South Carolina resident to file a new lawsuit.

The Associated Press contributed to this report