Saudi Arabia will open its border with Qatar to let pilgrims attend the hajj, marking a breakthrough in a monthslong rift between the two Gulf countries.

The official Saudi Press Agency reported Thursday that Qatari pilgrims will be allowed to enter the kingdom by land or through two Saudi airports, and that pilgrims would be flown to hajj at Saudi expense.

The move followed talks between Saudi King Salman and Sheikh Abdullah bin Ali Al Thani, a member of the Qatari royal family.

Saudi Arabia, the United Arab Emirates, Bahrain and Egypt cut diplomatic and transportation ties with Qatar in early June, alleging it supports extremists. Qatar denies the allegation and sees the charges as politically motivated.