The laws on prostitution in Sweden make it illegal to buy sexual services, but not to sell the use of one's own body for such services. Pimping, procuring, rape, and operating a brothel remain illegal. The criminalisation of the purchase of sex, but not the selling of one's own body for sex, was unique when first enacted in Sweden in 1999, but since then, Norway and Iceland have adopted similar legislation, both in 2009, followed by Canada in 2014, Northern Ireland in 2015, and France in 2016.
Prostitution is not mentioned in any law texts in Sweden in the middle ages, and was thus not formally a crime. However, under the influence of the church, sexual acts outside of marriage was criminalized for both sexes, which also affected prostitutes. The normal punishment for illegal sexual relations was fines or, if the accused was unable to pay them, pillorying, whipping or other disciplinarian physical punishments within the Kyrkoplikt. The law and procedure was the same in the question of actual prostitution: When the activity of Sara Simonsdotter was exposed in the capital in 1618, revealing her brothel with clients in high circles, she, her staff, and clients were sentenced to various forms of fines, pillorying, and physical punishments for fornication.
The earliest law to explicitly ban prostitution was in the Civil Code of 1734, where procuring and brothels was banned and punished with imprisonment, whipping and forced labor, and prostitution at a brothel with forced labor.
From 1724 onward, unmarried women in Stockholm with no certification asserting that they were supported either by a legal profession, a personal fortune, or by a sponsor guaranteeing their economic support, could be arrested for vagrancy and placed at the Långholmens spinnhus to prevent them from supporting themselves "indecently", and this was a method frequently used toward prostitutes. There were women active as courtesans, who prostituted themselves to upper class clients, such as the famed courtesan Catharina Norman, called "The Swedish Ninon", who did not belong to a brothel but met her clients at the theater or Opera and received them in her own home or in theirs: this class of prostitutes were protected from the police either by a certificate of sponsorship given by a client, or by having another official legal profession, usually as an actress or singer.