LISBON (Reuters) - A senior Portuguese government official quit on Thursday over accusations of misconduct in picking his cousin as his deputy, in an escalation of a wider nepotism row that could undermine the ruling Socialists ahead of an election in October.

FILE PHOTO: Portugal's Prime Minister Antonio Costa speaks during the Party of European Socialists annual meeting in Lisbon, Portugal, December 8, 2018. REUTERS/Pedro Nunes/File Photo

Carlos Martins, who ranks No. 2 in the Environment Ministry as secretary of state, resigned a day after his cousin, Armindo Alves, stepped down.

In a statement, Martins said he had quit to prevent the controversy damaging the government and the ruling party.

Prime Minister Antonio Costa’s minority government has been heavily criticized by opposition leaders in recent weeks after media highlighted family ties in a minor reshuffle last month.

Costa acknowledged last week that it was a “question of ethics if someone appoints a relative”, but also said that being a relative of a government or party member did not necessarily disqualify someone from performing official functions.

The cabinet includes a husband and wife - Interior Minister Eduardo Cabrita and Sea Minister Ana Paula Vitorino - and a father and daughter - Labour Minister Jose Antonio Vieira da Silva and Presidency Minister Mariana Vieira da Silva.

The wife of Infrastructure Minister Pedro Nuno Santos is also chief of staff to the secretary of state for parliamentary affairs.

Opposition leader Rui Rio told the state news agency Lusa that if the “Socialist family” sacked everyone who was related to someone else in the party or government, “then at a certain point there’ll be only a few left”.

The newspaper Jornal Economico reported on Tuesday that 27 people in the Socialist government had family ties to one another, to current or former lawmakers or to party leaders.

The Socialists lead surveys of voting intentions for October’s general election at 37-38 percent, well ahead of the center-right opposition but short of a parliamentary majority.