Where does this phrase come from? It's something I use (usually ironically) and something that's "just there" in my lexicon like "fit as a fiddle". However when I Google it, no origin pops up. It is used as early as 1855:
It is in his admiration for the gentle confines between virtue and her antagonist
This occurrence is 164 years old. A commenter below has used Google Ngrams to source "the confines_noun" to around 1650, so 369 years old (earlier if you make the search case insensitive).
In ironic use it refers to a place which is not gentle at all. So a phrase which lends itself to ironic use, like "your humble servant". It would be great if it turned out to be a phrase first used by Shakespeare or the like.