Koji Ueda, Associated Press
Streets in front of the parliament building, center in background, are blocked by police vehicles during a protest rally in Tokyo, Friday, Sept. 18, 2015. Japan's parliament is moving toward final approval of legislation that would loosen post-World War II constraints placed on its military, an issue that has sparked sizeable street protests and raised fundamental questions about whether the nation needs to shift away from its pacifist ways to face growing security challenges.

TOKYO — They filed frivolous no-confidence motions. They made long-winded speeches to explain them. One employed the "cow walk," moving slowly like a cow to the podium to vote on a motion.

Japanese opposition parties pulled out all the stops Friday in a last-ditch effort to block a vote on security bills that would fundamentally change the way Japan uses its military, a highly sensitive issue in a country where many take pride in its pacifist constitution.

Lawmakers met all day and into the evening before an expected late-night vote by the upper house to allow Japan to go into combat to defend countries other than itself for the first time since the end of World War II, after which Japan adopted a constitution that renounces the right to wage war.

The opposition's tactics caused longer-than-expected delays, though the eventual passage of the bills is all but assured because of the ruling bloc's majority. Opposition Democratic Party of Japan leader Katsuya Okada said it would do "whatever it takes" to block a vote.

The bills have already passed the more powerful lower house.

Joined by several other opposition parties, the Democrats submitted no-confidence motions in the upper house against Prime Minister Shinzo Abe, Defense Minister Gen Nakatani and upper house President Masaaki Yamazaki. The motions were all voted down, but each took several hours to complete.

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."

Yamamoto wore a black suit and tie with Buddhist prayer beads around his wrist, as if attending a funeral. He was repeatedly scolded by the house president, who eventually banned any more "cow walk" attempts.

In the lower house, opposition groups submitted an urgent no-confidence motion against Abe's Cabinet, forcing the upper house to go into a temporary recess.

The legislation would allow the military to defend Japan's allies even when the country isn't under attack, work more closely with the U.S. and other allies, and do more in international peacekeeping.

Abe says Japan needs the bills to bolster its defense amid China's growing assertiveness and to share global peacekeeping efforts. Opponents say the legislation violates the constitution and puts the country at risk of becoming embroiled in U.S.-led wars.

China said it and other Asian neighbors 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 Friday.

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

Abe's ruling Liberal Democratic Party was pushing to pass the bills before the start of a five-day weekend Saturday to avoid a possible swelling of the protests. Abe also promised the U.S. that the legislation would be approved by this summer.

Media surveys have consistently shown a majority of respondents oppose the legislation.

Associated Press news assistant Liu Zheng in Beijing contributed to this story.