The U.S. military said three American service members and a contractor were killed in an attack in Afghanistan near Bagram air base. (SAUL LOEB/AFP/Getty Images)

Three American service members and a contractor were killed in a car-bomb attack in Afghanistan on Monday, the U.S. military said.

The bomber struck as military personnel were conducting a security patrol near Bagram air base, a major air hub for foreign forces in Afghanistan, according to Col. Dave Butler, a spokesman for the U.S.-led military command there.

The Taliban asserted responsibility for the blast. On Twitter, a spokesman for the militant group said that a suicide bomber targeted “a convoy of American occupiers” near the base’s gates.

The attack brings to seven the number of American troops who have been killed this year in Afghanistan.

It takes place as the Trump administration intensifies its effort to facilitate a peace deal with the Taliban. U.S. envoy Zalmay Khalilzad met with President Ashraf Ghani and other Afghan leaders in Kabul in recent days, seeking to build support for nascent discussions with Taliban representatives in Doha, Qatar.

A series of U.S.-Taliban meetings has raised hopes that a political solution might finally be achieved nearly 20 years after U.S. military forces entered Afghanistan in the wake of the Sept. 11, 2001, terrorist attacks. But the initiative has also generated friction between Washington and Ghani’s government, which fears being sidelined in the talks.

President Trump has repeatedly voiced a desire to end the military mission in Afghanistan but has given his diplomats time to seek a political settlement.

Sharif Hassan in Kabul contributed to this report.