BEIJING — A proposed Chinese law threatens those making inappropriate use of the country’s national anthem with up to 15 days in jail, state media reported Monday, amid a surge in state-promoted patriotism under President Xi Jinping.

The draft legislation would make it illegal to play the anthem at funerals and on other “improper” occasions, as well as to “maliciously” modify its wording or present it in a “distorted or disrespectful” way, the Xinhua News Agency said.

Settings at which the anthem can be played include political gatherings, award ceremonies, flag-raising ceremonies, important diplomatic occasions and major sport events, Xinhua said.

The draft was given a second hearing Monday by the standing committee of the National People’s Congress, China’s legislature. Passage in a third hearing is required for it to become law.

“The legislation governing the use of the national anthem is feasible, necessary and of great significance to foster and practice socialist core values and to promote the patriotism-centered spirit of the nation,” Xinhua quoted Zhang Haiyang, deputy head of the legislature’s Law Committee, as saying.

Xi, China’s strongest leader in decades, has appealed to resurgent nationalism among the public by pursuing a strong military, the vigorous expansion of the world’s second largest economy and a muscular foreign policy that frequently seeks to confront the U.S. and other major powers. China recently established its first overseas military base in the Horn of Africa nation of Djibouti and Chinese companies have been scooping up overseas assets such as New York’s famed Waldorf Astoria hotel.

Xi, who has also led the ruling Communist Party since 2012, has established a growing cult of personality that leans heavily on his image as a patriotic leader who brooks no slight to national dignity.

China’s entirely state-controlled media relentlessly promote a view of China as morally superior to the West, and popular culture has been increasingly leveraged to stir patriotism among the younger generation for whom communism as a system has little meaning. The film Wolf Warrior II offering a bare-knuckled take on Chinese nationalism became the country’s all-time box office champion this summer, taking advantage of a two-month blackout period during which foreign films cannot be shown in Chinese cinemas.

China’s national anthem, titled “March of the Volunteers,” was originally featured in a patriotic play that ran during the nearly 15-year struggle against Japan that lasted through the end of World War II. Lyrics include “Arise, ye who refuse to be slaves, with our flesh and blood let us build our new Great Wall.”