Japan has banned the possession of child sex-abuse images, one of the last developed countries to do so.
The new law states that anyone found with such images can be jailed for up to a year, or fined up to $10,000 (£6,000).
The ban does not apply to animation or to comic art known as manga.
Japan was previously the only country in the 34-strong Organisation for Economic Co-operation and Development (OECD) without such a prohibition.
Opponents of the bill say that freedom of expression needs to be protected in a country that once suffered heavy government censorship.
Analysts say there was strong resistance from manga artists, free-speech advocates and publishers.
They said it would impinge on freedom of expression and allow authorities to make arbitrary decisions about art.
The Japan Magazine Publishers' Association, which represents over 90 publishing companies, posted a statement on its website earlier in June saying the law could "put a strain" on artists and publishing culture.
The BBC's Rupert Wingfield-Hayes in Tokyo says Japan is still considered one of the world centres for the exchange and consumption of images of child sexual abuse.
Crimes related to child sexual abuse have reportedly been on the rise in Japan.
Police uncovered 1,644 cases last year, about 10 times higher than a decade ago.
More than half of the cases involved sharing or selling photos or videos over the internet, police said.
The new law will allow those who do possess such material a year to get rid of it.
Japan had earlier banned the production and distribution of child pornography in 1999.