Singapore's former deputy prime minister Tony Tan was sworn in Thursday as the city-state's seventh president, days after winning a hotly contested election by a razor-thin margin, dpa reported. Tan, 71, considered the candidate closest to the ruling People's Action Party (PAP), won 35.2 per cent of the votes in Saturday's non-partisan poll, holding an edge of about 7,400 ballots over the closest of his three rivals in another sign that the PAP's popularity was eroding. He took his oath of office for a six-year-term, succeeding outgoing president SR Nathan, 87. Singapore presidents have a largely ceremonial role, but the constitution allows the head of state to veto the use of the country's reserves and some public office appointments. Tan has decades of experience as a banker and government minister. Political analysts said Tan's narrow win was a replay of the PAP's poor performance in May's general election. The party then posted its worst result in decades, winning 60 per cent of the votes, as many Singaporeans were unhappy with the government's handling of issues like the influx of foreigners and rising costs of living.