Where does the phrase "wild horses won't keep me away" come from

According the following sourse, it refers to a medieval torture:

Wild horses couldn't drag me:

  • Nothing could induce or persuade me, as in Wild horses couldn't drag me to that nightclub. This idiom, always in negative form, is believed to have replaced wild horses couldn't draw it from me, referring to the medieval torture of using horses to stretch a prisoner and thereby force a confession. [First half of 1800s ]

(The American Heritage® Idioms Dictionary)

Wild horses couldn't drag someone away (from something):

  • Prov. Someone is determined to remain with something. Once Elaine starts playing a video game, wild horses can't drag her away from it. Jim was determined to remain fishing at the lake. Wild horses couldn't drag him away from it.

(McGraw-Hill Dictionary of American Idioms and Phrasal Verbs. © 2002)

The expression is mainly an AmE one as shown in Ngram and is from the mid 19th century.

enter image description here