An oak chair that JK Rowling used while writing the first two books of the Harry Potter series has sold for 394,000 US dollars (£278,000).

The 1930s chair was one of four mismatched chairs given for free to the then little-known writer for her council flat in Edinburgh.

She wrote Harry Potter And The Philosopher's Stone and Harry Potter And The Chamber of Secrets while she was sat on it.

Before the Heritage Auctions sale in New York on Wednesday, the chair was auctioned twice before - once by Rowling to benefit charity.

Before she donated it to the Chair-ish a Child auction in aid of the National Society for the Prevention of Cruelty to Children in 2002, she painted on it: "You may not/find me pretty/but don't judge/on what you see."

She also wrote: "I wrote/Harry Potter/while sitting/on this chair."

The chair is accompanied by a signed letter 'by Owl Post" describing its history and provenance.

The letter reads: "Dear new-owner-of-my-chair / I was given four mismatched dining room chairs in 1995 and this was the comfiest one, which is why it ended up stationed permanently in front of my typewriter, supporting me while I typed out 'Harry Potter and the Philosopher's Stone' and 'Harry Potter and the Chamber of Secrets'. / My nostalgic side is quite sad to see it go, but my back isn't. / JK Rowling."

The seller, Gerald Gray, from Worsley, Greater Manchester, said the winning bid from an anonymous private buyer far exceeded his expectations.

"I plan to donate 10% to JK Rowling's charity, Lumos, because that's what she did in the first place," said Mr Gray, who runs a company in Oldham and Sarasota, Florida.

He said he would like to see the new buyer display it somewhere where children could see it, perhaps in a museum or theme park.

He bought the chair in 2009 after his daughter, a Harry Potter fan, saw it on eBay.