The law also makes it illegal to prepare for such a trip, or train other people to do it, or support people or organisations that carry out terrorist crimes with money - whether the money goes to terror crimes or not.
The law was proposed by the government, following a UN resolution and recommendations from the intergovernmental organisation Financial Action Task Force (FATF). Parliament also voted in favour of asking the government to come back with a proposal of how a passport can be confiscated, if a person is suspected of preparing to go, or already has gone, on a trip to take part in terrorism.
The Left party voted against substantial parts of the proposal, claiming that the law is too far-reaching, and that it risks criminalising ordinary transfers from people in Sweden to relatives abroad. This may be in breach of human rights according to the party.
Some of this chimes with what the Council on Legislation, whose job it is to scrutinise draft bills, has already said. In December, the council warned against "far-reaching criminalisation", which in practice "hits a range of every-day acts, even acts that can be seen to be motivated for humanitarian reasons"
Other critics have said that the main difficulty in punishing people who have taken part in terror crimes is not that there is a lack of laws to do so, but that it is hard to prove that the crimes have been committed.
According to the news agency TT, the Swedish security and intelligence police (Säpo) now says they have 299 names of people who have travelled from Sweden to Syria and Iraq to fight for the terror organisation IS over the past 2.5-3 years. That is 13 more people than in the beginning of the year. Out of the 299, 40 are believed to have died and an estimated 133 have returned to the country.
"Everybody has the capacity to carry out a terror attack, but I do not think many at all have the intention to do so," Anders Thornberg, head of Säpo, told TT.
According to Thornberg, they have no evidence that more people are leaving the IS and returning to Sweden, even though it seems the organisation is under more pressure in the wars in Syria and Iraq.
"We haven't seen that yet. It has become harder to return. Before you could travel back and forth. But there is also information, which has not been confirmed, that you can be executed or very harshly punished if you leave," said Thornberg.