House Speaker Nancy Pelosi (D-Calif.) is struggling to appease the left and moderate flanks of her caucus during a legislative-heavy month. (J. Scott Applewhite/AP)

House Democrats are careening toward intraparty battles that will test Speaker Nancy Pelosi’s authority over her caucus, as frustrated lawmakers embark on a legislative-heavy July filled with issues that divide their ranks.

Members return from the Fourth of July recess on Tuesday to deal with a defense policy bill that some worry won’t pass because of disputes between moderates and liberals over the amount of money to give the Pentagon. Democrats are also increasingly divided over how — or even whether — they should try to pass a spending bill for the Department of Homeland Security to restrict the Trump administration’s proposed deportations and ensure migrants are treated humanely.

At the same time, Democratic leaders are hoping to pass a long-stalled minimum wage increase that has split the party. And some Jewish members want a resolution condemning an anti-Israel protest to receive a vote before the long August recess — yet another divisive issue that will anger liberals who feel they’ve been ignored by leadership lately.

Looming is a fear that, should Democrats fail to unite around these critical bills, the House could get jammed by Senate Majority Leader Mitch McConnell (R-Ky.) — just as it did the last week of June on an emergency border bill. 

 House Democrats are still seething that the legislation was entirely negotiated by the Senate and ignored their demands to include standards of care for migrants in federal custody. Liberals are vowing to put up an even tougher fight to secure their own wins in July — demands that could repel centrists whose support is needed for the passage of any bill.

 “I was already thinking it was going to be difficult; it’s going to be even more difficult after today,” said Congressional Progressive Caucus leader Pramila Jayapal (D-Wash.) of the defense authorization bill as she left Washington in late June.

Time is of the essence. Leadership aides see July as one of their last major chances to pass policy priorities ahead of next year’s elections. Once they return in September, they’ll be overwhelmed with budget and debt ceiling negotiations. After that, the 2020 presidential race will kick into high gear, making legislating even more difficult as Democratic presidential candidates jockey for the nomination to take on President Trump.

The July schedule will create a serious math challenge for Pelosi, who suffered her first major defeat in the border talks before the recess, exposing a rift with Senate Minority Leader Charles E. Schumer (D-N.Y.).

While former speakers John A. Boehner (R-Ohio) and Paul D. Ryan (R-Wis.) faced constant demands from the right wing, which frequently blew up their agendas in the name of ideological purity, Pelosi must deal with unhappy lawmakers at both ends of her caucus, requiring that she strike a careful balance that can win approval from the left and the center.

Emotions were still raw as Pelosi told the New York Times’s Maureen Dowd that liberals such as Reps. Alexandria Ocasio-Cortez (D-N.Y.) and Rashida Tlaib (D-Mich.) made themselves irrelevant by opposing the border bill.

“All these people have their public whatever and their Twitter world,” Pelosi said. “But they didn’t have any following. They’re four people and that’s how many votes they got.”

Tlaib on Sunday pushed back on Pelosi’s criticism. “It is very disappointing that the speaker would ever try to diminish our voices in so many ways,” Tlaib told ABC’s “This Week.”

The stakes, Democrats know, couldn’t be higher. Should they fail to unite, McConnell could have the upper hand in negotiations on spending. It’s why, during a meeting this spring, Rep. Emanuel Cleaver II (D-Mo.) advised the caucus: “When friends fight, foes feast.”

 “We have to try to figure out a road down which the Democratic caucus can walk arm in arm,” Cleaver said. “If we can’t work things out in the Democratic caucus, then Congress will never get anything worked out because we have Mitch McConnell, who will fight everything. . . . We’ve got to stress and strain to include everyone’s consideration.”

The first test may be the toughest. The House will consider the typically bipartisan and popular defense bill as soon as this week. The legislation authorizes $733 billion in 2020 for aircraft, ships, personnel and other military requirements — less than the Senate Republicans’ proposed $750 billion but more than the $700 billion favored by liberals who want money for domestic programs.

 While liberals have applauded House Armed Services Committee Chairman Adam Smith (D-Wash.) for including their priorities, they are pressing for more concessions. And because House Republicans are not expected to vote for the bill, frustrated by the amount and policy changes at odds with the Trump administration, members of the party’s left flank know their votes are needed for passage, giving them leverage. 

Senior Democrats are hoping to package the bill with amendments that could ease liberals’ concerns. They expect a bipartisan amendment by Reps. Ro Khanna (D-Calif.) and Matt Gaetz (R-Fla.) — barring federal funds for any military force against Iran without congressional authorization — to pass. So could an amendment offered by Rep. Barbara Lee (D-Calif.) to prohibit the administration from using the 2001 authorization for the use of military force — passed to counter al-Qaeda — to justify U.S. involvement in other contemporary conflicts. 

“I think [there is a] good chance many progressives will back the NDAA given it’s our primary vehicle for checking the president on Iran and given the alternative is an unchecked Senate bill that will be much worse,” said Khanna, a liberal who sits on the Armed Services panel and could be a critical ally for Pelosi in trying to win over the left.

But Jayapal said that after what happened with the border bill in late June, liberals will fight harder to get what they want. Their biggest concern has been the overall spending level for the Pentagon and a perception that Democrats are funding unauthorized wars, making them complicit in the Trump administration’s actions, she said.

Just weeks ago, when leaders tried to put a Democratic bill on the floor, with $733 billion for defense, Jayapal personally told leadership that such totals were “impossible” for liberals to support. Those concerns still stand, she said, and she’d want to see amendments reducing the bottom line for the Pentagon.

“The bill that got passed out of committee has some good things but won’t be strong enough for progressives to vote for it,” Jayapal said.

Lowering the number, however, would repel centrists such as freshman Rep. Elaine Luria (D-Va.), whose district is home to the largest U.S. naval base. Luria, who hails from a Republican-leaning area, said she’s already preparing for the likelihood that the defense bill will not have support from liberals and has been talking to her Republican colleagues about what the bill needs to win their votes.

“My goal as a member of Armed Services is to work with my colleagues across the aisle so that when we finish the markup process on the floor, we have a bill that everybody can support,” she said. “This really is in my mind our most critical job in Congress.”

Democrats will also have to figure out how or whether to take a stand on homeland security funding. Pelosi and her leadership team do not think they should bring a Department of Homeland Security funding measure to the floor, knowing it could tank amid infighting and embarrass the party. 

But Hispanic leaders who visited detention facilities at the border over the recess say something must be done. There’s also a quiet fear that should House Democrats fail to pass anything, Senate Republicans in the fall will have the upper hand in spending negotiations.

Leadership aides believe they’ll finally pass a bill increasing the federal minimum wage to $15 an hour, legislation that’s been stalled for months because of concerns from centrists and moderates about small businesses that could be affected. Those fears, however, are not entirely alleviated. Cleaver, for example, said he plans to press leaders to include exceptions for rural communities that can’t afford to pay employees that much. Liberals, however, say that is unacceptable.

Another major flash point that may surface this month involves a resolution that would condemn the pro-Palestinian Boycott, Divestment and Sanctions (BDS) movement. Jewish members have pushed leadership — namely their top ally on the issue, House Majority Leader Steny H. Hoyer (D-Md.) — to allow a vote. Liberals, who view BDS as a protest of Israel’s treatment of the Palestinians, say the measure is too divisive to vote on now — and worry it sends the wrong message about Democrats’ valuing free speech.

“I’ve consistently heard from leadership that we will be voting before August recess, and I know we have the votes to pass it,” said Rep. Josh Gottheimer (D-N.J.), one of the members advocating for the resolution’s consideration. “They understand how critical it is that we consider this bill, particularly given growing anti-Semitism at home and globally.”

Mike DeBonis and Jenna Portnoy contributed to this report.