In the penultimate Edinburgh World Writers' Conference lecture, Patrick Ness argues that in 2012, the censorship we need to beware of is the subtle variety we impose on ourselves

I had intended to open this polemic with some version of this true story: earlier this summer, I was having dinner with friends and our conversation turned to the role of the veil in Islam, starting with how to explain a burkha to a son raised to believe that men and women are equal, before leading into the veil's potential as a form of oppression against women.

The friends I was having dinner with were two women, one a Palestinian raised in Jordan, the other English raised as a Muslim, and as our conversation progressed, it turned into how - for a number of reasons, some of them perhaps very good - it is far easier for them to discuss the issue of the veil publicly than me, a white western male, no matter how nuanced or well-intentioned my views.

Now, this is exactly the kind of thing I want to talk about today: the things we disallow ourselves to discuss. But a funny thing happened. I found myself drafting and re-drafting the way I opened with that anecdote again and again and again, working so hard to make sure my role in that conversation was clearly understood - and therefore impossible to misunderstand - that I found myself pounding the sentences into such painfully careful neutrality that they would end up meaning almost nothing.

But why? Why did I obviously think such care necessary, even while being painfully aware of the irony of this being a polemic about censorship?

Part of my hesitation is of course my own genuine impulse not to be in any way racist, a truly held wish to accommodate cultures and views not my own. There is also my desire not to have this polemic be just another tediously calculated controversy, like the ones Martin Amis seems to pull out every time he's got a new paperback on the way.

But if I'm honest, isn't part of it also fear? Fear of having whatever I'd say about the Islamic veil - no matter how thoughtfully I'd said it - misappropriated, misquoted or badly paraphrased in the inevitable tweeting that's going on right this very second? Fear of having my words turned into something they aren't, and having to suffer the consequences.

Anti-Censorship arts poster

Because the price of being misunderstood is very high. In the online world, nothing can be unsaid and nothing is off the record. And once you're forced, fairly or not, to start saying something like, "I'm not a racist," haven't you lost the legitimacy of your voice forever? Is that something a writer can risk?

What I've done, though, by being so careful, by even perhaps keeping silent on this or any issue, is disallowed myself a real voice in the conversation. I who consider myself a brave writer, one unafraid to push boundaries, to speak truth to power, I who believe these things about myself as much as any of you, I have in this instance self-censored. In a polemic about self-censorship.

And my argument to you today is that, paradoxically, this form of where every voice is heard. What we disallow ourselves to discuss - sometimes for good reason, yes, but sometimes for bad - can curtail our voices as effectively as any government or corporation ever could.

Now, the larger issue of censorship, by those very governments and corporations, is still obviously a huge one. But what I've faced with this polemic is what Mary McCarthy grappled with in 1962 when she delivered it. She said, "I imagine it has occurred to the audience ... that there is not going to be much problem with today's topic as there can't be too much disagreement."

Fifty years later, she's still right. I could easily have given an impassioned 15-minute talk about China's censorship of the internet, for example. Or how book-banning in schools remains a persistent problem in the US, even in 2012. I could have spoken of the hate tweets to Tom Daley or Louise Mensch or Fabrice Muamba. Or the disgrace of the Pussy Riot trial in Moscow. Or Great Britain's own problems with censorship: its outdated libel laws, its alarming flair for super-injunctions, its plans for secret courts, and on and on.

Censorship has not left the world. It only finds new avenues.

But as in 1962, these are all easy things to rise in opposition to, without much risk, without possibly even disagreement. Would we agree here today that Salman Rushdie has the right to produce The Satanic Verses? Would we agree that his recent experience during the Jaipur Literary Festival is a depressing blow against free speech?

There might be a few dissenters, but I suspect on the whole, we'd rally around Rushdie, and loudly - and proudly - claim our right and willingness to speak on any issue at any time.

But would we be correct?

Ask yourself, truthfully, would you sit down tomorrow morning and start writing a novel with Mohammad as your central character? A Mohammad treated as a fallible man rather than a prophet? A Mohammad perhaps even criticised?

This is a different question than should you be able to write this book. Because I suspect, again, that we would probably agree here in this room - if perhaps less so in the world at large - that of course you should, if the need to tell that story was great enough. But who here actually would?

Or consider something more benign, at least on the surface. However ashamed you might be to admit it, has the threat of a Bad Sex Award ever made you pause while writing a sex scene? It's entered my mind, and

frankly, it pissed me off. I wrote the scene anyway, of course, but even the thought that I'd momentarily hesitated made me angry.

For the record, I loathe the Bad Sex Award. I think it started as a funny idea, but in order to gain headlines and get writers like Haruki Murakami on the list, the otherwise intelligent people who - I hesitate to say "judge" it - have to temporarily pretend they understand neither context nor tone. So rather than what the Bad Sex Award could be - a discussion on how sex can be written honestly - it is instead an occasion for tittering and humiliation of the most public school kind.

However, having said that, have I now guaranteed that every bit of sex I might ever write will automatically be scrutinised by the Bad Sex Award? Does that enter my mind before both writing a sex scene or criticising the Award itself? Do I have to make the conscious decision not to self-censor rather than write freely, as an artist should?

What about if you're here today, among what is probably - correct me if I'm wrong - a fairly politically liberal gathering. What if you're here in this group, and you believe deeply in the freedoms I argue for: freedom of speech, the battle against censorship.

But what if you're also, say, against abortion? For you, it's a moral position you can't budge, no matter how socially liberal you otherwise consider yourself to be. In your heart, you believe abortion to be the taking of a life. Would you venture to speak that opinion here? Would you write a work of art that espoused that opinion?

Now, this is interesting, because I suspect you might not. But what if you did? What if you expressed that opinion here in a thoughtful but clear way? That opinion would have consequences, wouldn't it?

We'd like to pretend it wouldn't. I imagine we here think of ourselves as open-minded and accommodating to points of view other than our own, but how would an anti-abortion writer be received in a group like this? Politely, respectfully, I'd imagine. But within that politeness, would that writer's opinions on other topics be ignored because some of us would secretly think he or she is "not one of us, not really"?

Because this is the other self-censoring problem growing with the interconnectedness of the world. Instead of bringing us all together in an omnipresent, multi-faceted discussion, the internet instead has made sectarianism an almost default position. The nature of mass debate has become solely binary: you're on one side or the other. Factor that in with whatever combination of debates you've been forced to take sides on, and the number of people willing to listen to you - because they agree with you - shrinks daily. Try stating a strong opinion on gun control, for example, on Twitter and see how many followers you lose.

That's not the only example. This polemic is going on the Guardian website, and though no one really wants to say so out loud, most of us seem to accept these days that the comments on the Guardian on articles like this, while occasionally containing interesting replies, are far more often the domain of outraged point-missers, incandescently furious pedants, and trolls who don't bother reading past the sub-headline.

And again, did I pause about whether to include that paragraph, knowing this article will have comments beneath it? I did. More importantly, have I, by all that frankly liberating name-calling, just committed the same crime myself by dismissing any discussion I find unpalatable?

Because this is the kind of risk you run by saying something like that opinion about abortion. We here would almost certainly argue for your right to hold it, but in this sectarian, connected world, we'd then maybe stop listening to you. In a way, you'd be suddenly free of censorship because you'd be able to say whatever you like, you'd just be saying it to fewer and fewer people. And importantly, you'd be left out of conversations you'd like to be having.

Can an artist do this? Should an artist? Certainly, there are artists who are happy to talk to their own small sect in exchange for complete freedom to say whatever they will. But isn't the pushing of an artist into a small sect also a kind of censorship? And if chosen by the artist, isn't it a kind of self-exile? Of giving up on engaging? Of possibly even changing things because you're no longer part of a discussion that might?

For example, if you're a writer who wants to affect the world and engage with a large audience, would you risk being marginalised in the US by talking about your atheism? Would you risk the same marginalisation in England by talking about your devout Christianity?

Would you loudly proclaim a pro-Israeli position in Europe? Or a pro-Palestinian one in the US? Or go anywhere in the world and suggest Israel and Palestine may both have dirty hands?

Now, of course there's a natural elision between what we say in private versus what we say in public, but in a time where everything you say is now said to the entire world, are there areas where you've allowed that elision to justify not speaking what you see as the truth to save yourself from the consequences that could result?

How does an artist speak freely in this environment? I don't have a simple credo that answers this. I press on, I try hard, I work to say what I want to say in a way that keeps my voice both heard but also truthful, also standing up for what I believe in the most effective way I can. But I don't always get it right, I don't always make myself proud, and most importantly, I find that the struggle grows daily in the way the world now connects.

And so I ask you today, what do you not say? What do you censor when you write? Because I'm afraid I can't believe that you don't. You may be willing to do some of the things I've mentioned today, but all?

I like to think of myself as a fearless writer, and I'm sure that you all do, too. But are we really challenging ourselves enough to keep that true?

I don't think the question behind censorship today is any longer should you be able to say these things. Nor is it even a question so much anymore of if you can. The question has become, if you do.

• The Edinburgh World Writers' conference, hosted jointly by the Edinburgh International Book festival and the British Council, runs from 17-21 August, with contributions from Ali Smith, Irvinw Welsh, China Miéville and Patrick Ness