A new subway line in Rio de Janeiro - billed as one of the major legacy projects of this year's Olympics - will only open four days before the Games begin.

The extension to Metro Linha 4, which is due to link the main Rio 2016 Games hub at Barra de Tijuca with the city centre, will open on August 1, state transportation secretary Rodrigo Vieira confirmed.

With the Opening Ceremony taking place on August 5, this leaves little margin for error in case of any problems.

The launch will also be a "soft opening" - for athletes, media, fans with tickets and accredited personnel only - a plan which was first announced last month.

"We are doing, right now, and over the months of June and July, all the necessary tests," Vieira told The Rio Times.

"They are tests that begin as individual and go to compound tests, the movement of trains.

"During July, for example, we circulate Line 4 trains without passengers, so that all people involved in the new subway line get used to the operation.

“The day of August 1, before the Olympics, which begin on the 5th, we will open the special operation of the subway, which will have some conditions.

"These conditions can be set for a longer train range, and this range has been studied to be compatible with the start of the operation and at the same time would meet the city’s demand at that time, related to the Olympics.”

The extension of the line, westwards beyond Ipanema Bay, is designed to improve the commute for more than 300,000 people a day.

It is also envisaged as the main way in which thousands of spectators will travel between the city centre and the Olympic Park during the Games, taking pressure off a road system which is already a bottleneck in rush hour.

The project has been plagued by delays, however, with concerns peaking in February when a leaked email sent by Rio de Janeiro Mayor Eduardo Paes to the International Olympic Committee (IOC) warned of a "high-risk" it will not be ready in time.

He suggested they should consider alternative solutions.

Problems were exacerbated by financial woes affecting the State Government responsible for development work, as well as the harsh rocky terrain the line needs to navigate.

A "major breakthrough" was claimed in April, with constructors breaking through the final rock wall to complete a connected tunnel system throughout the length of the line.

"If the line is not open, or if there is a break-down during the Games, more buses would be organised to pick up spectators," said the IOC's leading Rio 2016 advisor Gilbert Felli in October.

"That means you will have more people in the road.

"If the Metro is not open, people may have to leave for events an hour earlier, but that will not be the end of the world.

"If it closes suddenly, for a day you will have difficulties then we will adapt it."