Security service MI5 has been named Britain's most gay-friendly employer by lesbian, gay, bisexual and trans charity Stonewall.

The LGBT rights charity's workplace equality index listed Lloyds Banking Group in second place and the National Assembly for Wales in third place.

Police Scotland was listed at number 83, and Royal Bank of Scotland joint 36 with MI6, the international security wing.

The survey found 21 per cent of respondents in Scotland were comfortable being completely out in the workplace.

The Herald: Shareholders have backed the Royal Bank of Scotland's cash call

The index has been running for 12 years. Stonewall received 400 entries from individual organisations, and surveyed over 60,000 staff.

Factors for which employers were rated by staff included culture and diversity.

Andrew Parker, MI5 director general, said diversity "is vital for MI5, not just because it’s right that we represent the communities we serve, but because we rely on the skills of the most talented people whoever they are, and wherever they may be.

"This accolade from Stonewall is a great acknowledgement of continued progress we have made over recent years in ensuring we draw on the widest possible pool of talent in our vital work.’

Ruth Hunt, Stonewall chief executive, said: "MI5 have made fantastic strides in creating an inclusive workplace, and have now appeared on the Stonewall Top 100 Employers list since 2012.

"This is an amazing achievement and demonstrates just how seriously diversity and inclusion is taken."

She added: "I’d also like to thank all of those organisations that took part in Stonewall’s 2016 Workplace Equality Index, and congratulate our Top 100 and award winners.

"We’re thrilled to see such a commitment to lesbian, gay, bi and trans colleagues, but we also know that there is still lots to do."

Stonewall Workplace Index

Top 100 Employers List 2016

1 MI5

2 Lloyds Banking Group

3 National Assembly for Wales

4 B3Living

5 Pinsent Masons

5 Tower Hamlets Homes

7 Leicestershire County Council

8 Metropolitan

9 Clifford Chance

10 Royal Navy

11 Baker & McKenzie

11 PwC

13 Cheshire Fire & Rescue Service

13 Victim Support

15 Newcastle City Council

15 Suffolk Constabulary

17 Freshfields Bruckhaus Deringer

17 Leicestershire Police

17 Welsh Government

20 Cardiff University

20 Creative Skillset

22 Circle Housing Group

22 Norton Rose Fulbright

22 Sussex Police

25 Crown Office & Procurator Fiscal Service

25 Herbert Smith Freehills

25 Northumberland County Council

28 Birmingham City Council

29 Golden Jubilee Foundation

30 Essex Community Rehabilitation Company

30 London Borough of Tower Hamlets

32 Norfolk Constabulary

32 Oxleas NHS Foundation Trust

32 Royal Bank of Scotland Group

32 The Army

36 MI6

36 Office for National Statistics

36 Swansea University

36 Your Homes Newcastle

40 Financial Conduct Authority

41 J.P. Morgan

41 Sheffield City Council

43 BP

44 KPMG

44 Teesside University

46 Aviva

46 Central London Community Healthcare NHS Trust

46 London Ambulance Service NHS Trust

46 North East Ambulance Service NHS Foundation Trust

50 Cardiff & Vale University Health Board

50 Touchstone

50 University of Birmingham

53 University of Essex

53 University of Manchester

55 Core Assets Group

56 DWF

57 Hogan Lovells

58 De Montfort University

58 St Andrew's Healthcare

60 Bury Council

61 Land Registry

61 University of Sheffield

61 York St John University

64 L&Q

64 Leeds Beckett University

64 Nottinghamshire County Council

64 Nottinghamshire Police

68 EDF Energy

69 The Riverside Group

70 HSBC Bank

71 West Midlands Police

72 Betsi Cadwaladr University Health Board

72 Environment Agency

72 Northumbria Healthcare NHS Foundation Trust

72 Reed Smith

72 St Mungo's

72 The Co-operative Group

78 Rhondda Cynon Taf County Borough Council

78 Suffolk County Council

80 CMS Cameron McKenna

80 University of Greenwich

82 Southend-on-Sea Borough Council

83 ASDA

83 Police Scotland

85 Carmarthenshire County Council

86 Barnardo's

86 Eversheds

86 Hertfordshire Partnership NHS Foundation Trust

89 Nottinghamshire Fire & Rescue Service

90 Bank of America Merrill Lynch

91 National Crime Agency

92 London South Bank University

93 Macquarie

93 Medway Council

93 Vision West Nottinghamshire College

96 London Borough of Islington

97 Berkshire Healthcare NHS Foundation Trust

97 Dentons

97 Nottingham City Council

100 Citi

100 Fujitsu