SHANGHAI (Reuters) - China’s new film law, its first formal legislation for the fast-growing sector, will target fake box-office sales and look to ensure movies reflect the country in a positive light, the official Xinhua news agency said late on Monday.

The legislation, set to take effect in March next year, laid out harsh punishments for producers using box-office fraud to artificially pump up ticket sales - a practice which has in-part helped propel huge market growth over the past few years.

China has been cracking down on ticket fraud that many say is behind a marked slowdown in box-office sales, which dipped almost a quarter in October versus 2015, according to market research firm Entgroup.

Despite the slowdown, China is a magnet for Hollywood studios looking to tap into the country’s growing middle class, but who face various challenges from state scrutiny over content to a cap on the number of imported films.

The law, passed by the largely rubber-stamp parliament on Monday, said films should “serve the people and socialism”, Xinhua reported. Foreign film makers “damaging China’s national dignity, honor and interests, or harming social stability or hurting national feelings,” were not welcome, it added.

It also laid out stricter rules for actors and film makers, saying people employed in the industry should have “excellent” moral integrity and “self-discipline”, Xinhua said. This follows recent cases of celebrities caught taking drugs.

($1 = 6.7784 Chinese yuan renminbi)