With no chance of success, as in He tried to get the town to change the street lights, but because there was no money in the budget he found himself without a leg to stand on. A related idiom is
not have a leg to stand on, as in Once the detective exposed his false alibi, he didn't have a leg to stand on. This metaphoric idiom transfers lack of physical support to arguments or theories.
[ Late 1500s