WASHINGTON — A federal judge on Saturday overturned the Washington, D.C., ban on carrying handguns outside the home, saying it was unconstitutional.

“There is no longer any basis on which this court can conclude that the District of Columbia’s total ban on the public carrying of ready-to-use handguns outside the home is constitutional under any level of scrutiny,” said Judge Frederick J. Scullin Jr. of the District of Columbia District Court.

“Therefore, the court finds that the District of Columbia’s complete ban on the carrying of handguns in public is unconstitutional,” he added in his 19-page ruling on the case, Palmer v. District of Columbia, which has been dragging on for five years.

The court ordered the city to allow residents to carry handguns outside their homes and to let nonresidents carry them as well.