Sweden on Wednesday outlawed sex not based on mutual consent, with campaigners hoping other European countries would also toughen up rape legislation after the #MeToo anti-harassment campaign.

With the new law, Sweden will join a small number of countries, including Britain and Canada, where the lack of consent in sex, even without violence, is enough to constitute a crime.

Details about the law on the Swedish government website said there will no longer be a requirement to prove violence or the threat of violence to obtain a conviction.

The law, due to come into force on July 1, stopped short of making expressed consent a condition for consensual sex but stressed passivity was not a sign of agreeing to sex.

Women's rights campaigners said they hoped the law would spark change across Europe where most nations still define rape as an act carried out with the use or threat of violence.

"While there is still a great distance to travel, we are hopeful that today's decision will herald a Europe-wide shift in legislation and in attitudes," Anna Blus, a researcher on women's rights for Amnesty International, said in a statement.

Law and order is likely to be a major issue in Sweden's parliamentary election in September with the populist, opposition Sweden Democrats linking public concern about a rising crime rate to an increase in immigrants.