The foreign secretary, Boris Johnson, has lifted a ban on UK embassies and high commissions flying the rainbow flag during gay pride events.

In one of his first policy shifts since coming to office, Johnson overturned the decision of predecessor, Philip Hammond, who insisted that only the Union flag, the EU’s blue-and-gold flag and the flags of the nations and overseas territories of the United Kingdom could be flown from Foreign Office buildings.

The decision on whether and when to raise the gay pride banner will be for individual ambassadors and high commissioners, taking into account local conditions.

The decision was revealed by PinkNews, which quoted a Foreign Office spokesman saying that the rainbow flag could be flown to mark events such as the International Day Against Homophobia, Biphobia and Transphobia (IDAHOBIT) on 17 May as well as local pride celebrations.

A Foreign Office spokesperson confirmed the news to the Press Association.

While still foreign secretary, Hammond last month rejected a call from the House of Commons foreign affairs committee to drop his opposition to use of the rainbow flag.

In a report on the FCO’s human rights work, the committee said Hammond’s decision not to fly the flag for Pride 2015 in London “signalled an apparent change in FCO policy and sent a message that contradicts much of the actual work and objectives of the FCO”.

The cross-party report recommended that the policy should be reversed and said that missions should fly the rainbow flag on 17 May in countries where official intolerance prevents the staging of gay pride events.

In an official response published on 11 July, the Foreign Office said: “The FCO has a very clear policy on flag flying: it is to fly the Union flag at the FCO and all its embassies, high commissions and consulates at all times.

“The only other flags that are flown are of the constituent countries of the UK and the UK overseas territories on significant days for them, and the European Union flag in certain countries … The UK is a member of, or supports, many organisations and associations, but does not fly any other flags.”