The University of Maryland’s bid for an undefeated regular season ended Thursday night with a 4-2 ACC loss at Wake Forest, the top-ranked Terrapins’ first setback in 17 matches.

Maryland (14-1-2, 6-1-1) was seeking to complete the program’s first unbeaten campaign since 1968. John Stertzer and Christiano Francois provided a 2-1 lead, but Ross Tomaselli scored the equalizer early in the second half and Maryland defender London Woodberry received a red card with 25 minutes remaining.

Luca Gimenez broke the tie three minutes later and Danny Wenzel converted a penalty kick in the 77th minute for the 18th-ranked Demon Deacons (11-3-4, 4-1-3).

The ACC tournament begins Monday with eighth-seeded North Carolina State facing No. 9 Virginia Tech in College Park, Md. The next day, the winner will play top-seeded Maryland in the quarterfinals. Woodberry will miss that game and faces an additional suspension.

The other quarterfinal pairings (unofficial): No. 7 Duke at No. 2 North Carolina, No. 6 Virginia at No. 3 Wake Forest and Clemson vs. Boston College, who are tied for fourth place.

The semifinals and final will be held at Maryland SoccerPlex in Montgomery County, Nov. 9-11.