China's national legislature on Monday overwhelmingly approved a law authorizing a military attack to stop Taiwan (search) from pursuing formal independence, a day after President Hu Jintao told the 2.5 million-member People's Liberation Army to be prepared for war.

The measure was approved by a vote of 2,896 to zero, with two abstentions at the closing session of the annual session of the figurehead National People's Congress (search).

"We shall step up preparations for possible military struggle and enhance our capabilities to cope with crises, safeguard peace, prevent wars and win the wars, if any," the official Xinhua News Agency quoted Hu as saying Sunday.

Hu's comments, made to military delegates at the national legislature, appeared aimed at underlining Beijing's determination to unify with democratically ruled Taiwan, which split from the Chinese mainland in 1949.

Also Sunday, Hu was appointed as chairman of the government's Central Military Commission (search), a largely symbolic move that capped a generational transfer of power. He already heads a parallel party commission that runs China's military.

Hu, 62, has shown no sign of diverging from former President Jiang Zemin's hard-line stance toward Taiwan, a democratically ruled island that Beijing insists is part of the communist mainland.

The two sides split in a civil war more than 50 years ago, and Beijing has long threatened to invade if Taipei takes formal steps toward independence.

The anti-secession law passed Monday is aimed at discouraging self-ruled Taiwan, which Beijing claims as its territory, from making its de facto independence permanent.

"We must ... always place the task of defending national sovereignty, security and territorial integrity and safeguarding the interests of national development above anything else," Xinhua quoted Hu as telling military delegates to the congress.

Delegates to the NPC burst into applause after the approval of the law, shown live on national television.

"This law ... represents the people's determination not to allow Taiwan to be separated from China by any means or any excuses," said Wu Bangguo, China's No. 2 leader and chairman of the parliament.

Taiwan's government has condemned the law, saying it risks raising tensions. The United States also appealed to China not to enact the measure.

Taiwanese President Chen Shui-bian has said it "enables China to unilaterally decide Taiwan's future and ignore that Taiwanese have the right to choose a democratic and free lifestyle."

The United States would be Taiwan's most likely defender if China attacked. Washington is lobbying strongly against European Union plans to lift a 15-year-old arms embargo against China, arguing that high-tech European weapons might be used against Taiwanese or U.S. forces.

Hu replaced Jiang as Communist Party leader in 2002 and as president the next year, as power passed to a new generation of Chinese leaders. He succeeded Jiang as head of the party's military commission in September.

Analysts say Jiang, 78, still exerts influence, but not to the extent that his predecessor, Deng Xiaoping, did after retiring from his government posts. Deng was considered China's paramount leader until his death in 1997.

Unlike earlier Chinese leaders who were revered as heroes of the 1949 communist revolution, neither Hu nor Jiang has military experience.

The Communist Party newspaper People's Daily said Sunday that the anti-secession law "shows the Chinese people's common will and firm determination of safeguarding territorial integrity and sovereignty and absolutely does not allow Taiwan independence forces to separate Taiwan from China by any name or by any means."

Jiang, a former Shanghai mayor, was chosen to head the party in 1989 in the tumult that followed the military crackdown on pro-democracy protests centered on Tiananmen Square in Beijing.

He served as president from 1993-2003. During his leadership, China boomed economically even as it remained an authoritarian one-party political system.