The approval at the upper house puts the legislation into law, loosening post-World War Two constraints on use of force by the military to self-defence only.

The legislation, passed by the more powerful lower house in July, sparked sizeable protests and debate about whether the nation should shift away from its pacifist ways to face growing security challenges.

Rallies have spread across the nation especially after the ruling parties approved the bills in July in the more powerful lower house.

Japan's military can now defend its allies even when the country is not under attack, and work more closely with the US and other nations. Japan will also be able to participate more fully in international peacekeeping.

"The legislation is necessary in order to protect the people's lives and their peaceful livelihood, and it is to prevent a war," Prime Minister Shinzo Abe told reporters after the passage of a total of 11 bills - one related to international peacekeeping and a package of 10 others designed to allow Japan's military to defend its allies in an action called "collective self-defence".

Dozens of constitution scholars, lawyers and other legal experts have joined protests, saying the legislation allowing Japan to use force to settle international disputes violates its US-drafted postwar constitution that renounces a right to wage war.

China said it and other Asian neighbours are closely watching the vote because of Japan's wartime aggression.

"We demand that Japan genuinely listen to just appeals from both at home and abroad, learning from historical lessons and adhering to the path of peaceful development," Chinese Foreign Ministry spokesman Hong Lei told a regular news briefing.

Previous postwar governments had all made the notion of collective self-defence unconstitutional.

But Mr Abe's Cabinet last year decided to allow it by unilaterally adopting a new interpretation of the constitution, instead of formally revising the charter, saying it must be adapted to today's increasingly challenging security environment. The constitutional reinterpretation also triggered public criticism that Mr Abe's government undermined democracy.

Even though many Japanese acknowledge growing security risks and have grown accustomed to sending peacekeepers overseas, many remain wary of a greater military role. Media surveys have consistently shown a majority of respondents oppose the legislation.

"This legislation betrays the constitutionalism, pacifism and democracy that Japan has built over the past 70 years since the end of World War II," said Tetsuro Fukuyama, a senior lawmaker representing the main opposition Democratic Party of Japan.

Opposition lawmakers chanted "Unconstitutional!" and "Invalid!" while casting a ballot during a vote on the bills at the upper house, which came at the end of the session.

Since Thursday, opposition parties had pulled out all the stops to delay the vote. They introduced a series of no-confidence measures against government ministers and parliamentary leaders, and made filibuster speeches.

One opposition lawmaker, Taro Yamamoto, used a snail-paced "cow walk" to shuffle to the podium, while others made drawn-out speeches, a variation that has become known as the "cow tongue".

Mr Yamamoto wore a black suit and tie with Buddhist prayer beads around his wrist, as if attending a funeral. He kept using the "cow walk" tactic, ignoring repeated scolding by the house president to stop it and heckling from the ruling lawmakers criticising him.

The steps were destined to fail, but ate up hours of time requiring debate and votes on each measure.

As the drama played out in Parliament, protesters rallied outside for a fifth night in a row. On Wednesday, 13 protesters were reportedly arrested.

Mr Abe's ruling Liberal Democratic Party rushed to pass the bills before the start of a five-day weekend on Saturday to avoid a possible swelling of the protests. Mr Abe had promised the US that the legislation would be approved by this summer.