Historian and author Niall Ferguson has apologised "unreservedly" for "stupid and tactless" remarks in which he implied that John Maynard Keynes did not care about future generations – because he was childless and gay.

Ferguson, a professor at Harvard, was speaking at the Altegris conference in California, which attracts an audience of investors and financial analysts, when he was asked questions about the influential British economist. "I made comments about John Maynard Keynes that were as stupid as they were insensitive," he said in a statement emailed to the Observer and also posted on his website.

The apology came after reports emerged from bloggers and financial reporters at the conference that Ferguson claimed Keynes's economic philosophy was influenced by his homosexuality. Lance Roberts, a reporter for the website StreetTalk Live, posted a transcript of notes taken from Ferguson's speech and a question-and-answer session afterwards.

Roberts said Ferguson appeared to allude to a theory that Keynes's long-term economic theories were flawed because he was gay and had no children. "Keynes was a homosexual and had no intention of having children. We are not dead in the long run … our children are our progeny. It is the economic ideals of Keynes that have gotten us into the problems of today," Roberts wrote in his notes of Ferguson's remarks.

Another reporter, Tom Kostigen of Financial Advisor, gave a longer account. Kostigen wrote that Ferguson had also made mention of the fact that Keynes had married a ballerina, despite his gay affairs. "Ferguson asked the audience how many children Keynes had. He explained that Keynes had none because he was a homosexual and was married to a ballerina, with whom he likely talked of 'poetry' rather than procreated," Kostigen wrote. He added that the audience at the event went quiet when the remarks were uttered.

The account was also backed up by a Twitter message posted by conference attendee and journalist Daniel Jamieson, a senior editor at Investment News. "Ferguson … Keynes didn't care about the long-run 'cause he was a homosexual, had no children'," he wrote.

In his apology Ferguson explained: "I had been asked to comment on Keynes's famous observation 'In the long run we are all dead.' The point I had made in my presentation was that in the long run our children, grandchildren and great-grandchildren are alive and will have to deal with the consequences of our economic actions."

He added: "I should not have suggested – in an off-the-cuff response that was not part of my presentation – that Keynes was indifferent to the long run because he had no children, nor that he had no children because he was gay. This was doubly stupid. First, it is obvious that people who do not have children also care about future generations. Second, I had forgotten that Keynes's wife Lydia miscarried."

Kostigen left little doubt in his account that he found Ferguson's remarks offensive. "Apparently, in Ferguson's world, if you are gay or childless, you cannot care about future generations nor society. This takes gay-bashing to new heights," Kostigen wrote.

Ferguson insisted he was not anti-gay. "My disagreements with Keynes's economic philosophy have never had anything to do with his sexual orientation. It is simply false to suggest, as I did, that his approach to economic policy was inspired by any aspect of his personal life. As those who know me and my work are well aware, I detest all prejudice, sexual or otherwise," he said.

"My colleagues, students and friends – straight and gay – have every right to be disappointed in me, as I am in myself. To them, and to everyone who heard my remarks at the conference or has read them since, I deeply and unreservedly apologise," he added.

Ferguson's retracted assessment of Keynes's outlook echoes arguments previously aired by American historian Gertrude Himmelfarb. She wrote that the economist's links to the Bloomsbury set – known for their philosophy of living for the moment – were reflected in his economic theories. Himmelfarb, too, mentions Keynes's "in the long run" pronouncement and cites Austrian economist Joseph Schumpeter who once referred to Keynes's "childless vision".

Ferguson, a Scot, is an outspoken figure who has written numerous bestselling books on history and economics including Empire: How Britain Made the Modern World and The Ascent of Money: A Financial History of the World.

He has fought in public with other well-known figures, including Nobel prizewinning economist Paul Krugman over the economic policies of Barack Obama, and writer Pankaj Mishra. Mishra had been critical of Ferguson's book Civilisation in the London Review of Books and Ferguson accused him of labelling him as a racist and threatened to sue for libel.

Ferguson's views, often criticised for placing too much of a positive spin on western empires and imperialism, have won high-profile support among some rightwing politicians, especially the British education secretary, Michael Gove.