Kieran Ridley, 32,  poured petrol onto a nearby bin and lit it, the High Court in Edinburgh was told.
He then left the property at Mallaig, Lochaber, having locked the front and back doors and some windows.
Mr Ridley denies the charges. His lawyers argue he was not criminally responsible due to mental disorder.
The court was told that 11 people were inside the property including four children between the ages of two and 16.
In a statement agreed by the Crown and Mr Ridley's defence team, the court heard that Mr Ridley turned on the gas valves on the kitchen cooker  late on 27 October last year.
At some point between 23:00 and 23:30 he poured petrol onto a nearby waste bin and set fire to it, causing cladding and a skirting board to catch light.
He then left the house, having locked both front and rear doors and some of the windows.
The trial heard that Mr Ridley, whose address was given as HMP Inverness, was detained by police later that night at Cameron Avenue, Mallaig
The people in the house - called Mallaig Mhor- included his mother, brother, children aged two, eight, 15 and 16 and five other adults.
The trial, before judge Craig Scott QC continues on Monday.

Ashley Sibery, 39, persuaded Sital Sibery to take the class A drug minutes after she confronted him about his drug habit in their home.
It happened on 2 April 2012 at their London Street property.
Sibery pleaded guilty to a charge of culpable and reckless conduct at Edinburgh Sheriff Court.
The court heard that when Mrs Sibery decided to confront her husband because of his erratic behaviour, the GP admitted he had been using the narcotic for two months.
She told him if he did not quit his addiction, she would end his marriage to him.
But despite the ultimatum, Sibery managed to persuade his wife into taking what was supposed to be his final fix.
The court heard how Sibery wanted his wife to experience the feeling he got when he took the heroin.
However, Mrs Sibery collapsed and started having difficulties breathing.
The court also heard that Sibery, who was on bail for the offence, was now in the care of a consultant psychiatrist who was helping him to tackle his problems, and that he and his wife were still together.
Sheriff Jarvie told Sibery that she would pass sentence on him at a hearing next month.

Shaun Ingram from Saltash booked his Ford Focus ST in for a major service at Halfords Autocentre in Plymouth in March.
On its return he discovered the dashboard camera recorded footage of his car being driven 57 mph in a 30 mph zone.
Halfords said the mechanic was a temporary employee who had been let go.
After the complaint the company has apologised and offered to refund the Â£255 for the MOT and service.
Mr Ingram said the camera was in plain sight on the windscreen and was not left on to "catch anybody out" during the service.
The camera recorded almost seven hours of footage including the mechanic swearing and talking about test-driving the car.
Mr Ingram said: "When I saw the footage I was left open-mouthed. The mechanic was abusing my car and my trust.
"As a nationwide company I thought I had nothing to worry about. I feel very let down."
The regional manager for Halfords Autocentres, Daren Stone, told Mr Ingram that the mechanic's behaviour was unacceptable.
He said: "He drove your car in what I can only describe as an appalling manner.
"I do not and will never condone that level of pure neglect which is why the mechanic in question has been removed from working within the Halfords Autocentre Group."
Mr Ingram said: "From now on I will always wait by the car whilst it is being serviced."
A spokesperson for Halfords head office said: "We are looking into the full details of the incident and will deal with this issue internally as a matter of urgency to ensure this type of incident does not occur again in the future."
A man accused of attempting to murder 11 people at a remote Highland holiday home started a fire after opening gas valves on a cooker, a court has heard.
[NEXT_CONCEPT]
A drug-addicted doctor watched his wife lose consciousness and struggle for breath moments after injecting her with heroin in Edinburgh, a court has heard.
[NEXT_CONCEPT]
A Halfords customer's dashboard camera caught a mechanic speeding in his car while it was booked in for an MOT.